-
Notifications
You must be signed in to change notification settings - Fork 0
Users
List users endpoint reference on the official TravelPerk documentation.
This function will list all users.
#Get all users without pagination
users = travelperk.scim().users().query().get()
#Get paginated users
users = travelperk.scim().users().query().set_count(
3
).set_start_index(
3
).get()
Create a new user reference on the official TravelPerk documentation.
A user can be created using the create method, setting the minimum required parameters like this:
newUser = travelperk.scim().users().create(
'username',
True, # Create an active user
'Given name',
'Family name'
)
Or for more complex user creation the make
method can be used for creating a new user request, setting all available attributes an finally calling the save
method for sending the new user to TravelPerk like:
newUser = travelperk.scim().users().make(
'username',
True, # Create an active user
'Given name',
'Family name'
).set_locale('en')
.set_title('manager')
.save()
Retrieve a user endpoint reference on the official TravelPerk documentation.
Given a user id this function will return all user fields.
user_id = 1
user = travelperk.scim().users().get(user_id)
Update a user endpoint reference on the official TravelPerk documentation.
This operation has not been implemented yet you can use Replace a user instead.
Replace a user endpoint reference on the official TravelPerk documentation.
Given a user id and a set of attributes this will override all of a user's attributes.
user_id = 1
replaced_user = travelperk.scim().users().modify(
user_id,
'username',
True, # Active user
'Given name',
'Family name'
).set_locale('fr').save()
Delete a user endpoint reference on the official TravelPerk documentation.
Given a user id this function will remove it.
user_id = 1
travelperk.scim().users().delete(user_id)
Will return all possible genders.
travelperk.scim().users().genders()
Will return all possible languages.
travelperk.scim().users().languages()