Service endpoint that lets to perform 1 to 10 operations to create, read, update or delete users and assign Spaces license to new created or existing user. Only service app authentication is permitted. User emails must belong to the same company that owns service app. Service app must have "accounts.users.bulk.write" scope to use this endpoint.
Please note, that it takes ~5min for language change to take effect after synchronizing across accounts portal and the spaces client.
Supported actions
Action | Description. |
---|
create | Create new user. |
read | Get information about user. |
update | Update user's information. |
delete | Delete user. |
merge | If user with provided email does not exist - create new user with the information provided in the request (password for new user is required, see "Body Parameters"). If user already exists - update the existing user with the information provided in the request. |
URL Parameters
None.
Body Parameters
Name | Description | JSON type | Required | Valid Values |
---|
action | Action | string | Yes | "create", "read", "update", "delete", "merge" |
email | User email | string | Yes | Must be valid email. Must belong to one of domains of company. |
password | New password when create or update user | string | create-Yes, read-No update-No, delete-No | Length must be 4-200 characters |
firstname | User's first name. If both firstname and lastname are empty or none, set email as user name. | string | No | Must not contain special characters (|~!@#$%^&*()_+=<>?:;,."). Total length user's displayname ("firstname" + "lastname") must not be greater than 380. |
lastname | User's last name. If both firstname and lastname are empty or none, set email as user name. | string | No | Must not contain special characters (|~!@#$%^&*()_+=<>?:;,."). Total length user's displayname ("firstname" + "lastname") must not be greater than 380. |
language | User's primary language. If empty or none set default language ("en") as user's primary language when "action" is "create" and do nothing if "action" is "update". If value was not recognized as existing language code, set default language ("en") when "action" is "create" and do nothing if "action" is "update". | string | No | |
cellphone | User's mobile phone number. | string | No | Must be valid phone number, starting with "+" |
workphone | User's work phone number. | string | No | Must be valid phone number, starting with "+" |
license_type | Spaces license type to assign. Company must have license of this type. If "action" is "update" and value is empty (""), deallocate spaces license from user if user has one. | string | No | "spaces_power", "spaces_business", "" |
Authentication
ServiceAppAuthenticator
Authorization
None
Example Request
URL
For Production: POST https://accounts.avayacloud.com/api/1.0/users/bulkupdate
For Staging: POST https://onesnastaging.esna.com/api/1.0/users/bulkupdate
Headers
Authorization: "service_app eyJhbGciOiJSUzI1NiIsIdfgdfgnR5cCI6IkpXVCJ9.eyJ1c2VyX2lkX3NpZyI6ImxPWHpxNzVzR3J3X0xwWEMyRGRMakhyYXJlWVhyTzFMdEZHZkhkOWNkTXciLCJwcm9kdWN0X3R5cGUiOiJhY2NvdW50cyIsImxhc3R1cGRhdGV0aW1lIjoiMjAxNy0wMS0zMFQxMzo1ODo0Ny4yMDYiLCJpc3MiOiJ6YW5nLmlvIiwicHVibGlja2V5aWQiOiJhZ3h6Zm05dVpYTnVZVEl3TVRSeUdnc1NEVWRLZDNSUWRXSnNhV05MWlhrdfgdWdJQ2dsUEtFakFvTSIsImV4cCI6MTQ5NTM5MTIwMywidXNlcl9pZCI6ImFneHpmbTl1WlhOdVlUSXdNVFJ5RVFzU0JGVnpaWElZZ0lEQXMtX25fUW9NIiwidmVyIjoiMi4wIn0.SqZpw1uPIebqW3qlDsm0-DWYFKEH0SgPwtD-tSESWOF-5hLkZMqJH28ooWux2S7s9riIew7pTVPnZpTgJa5zHcEAG0gXSEJVOqmpGp_4ufM8YtZoZMpBFjyAkwyAt-ILkGUYIo0GU5WyzMPLV8YLXfgdfgOgkE2MGGOajBkjPmC2Db3pA0D0M9k-21EL1gwWBC5YIq0PDAkgulegwl6khRmB8irJQ-dfg-d-KV9eYfFpsCdJKRGzSfqg"
Body
[{
"action": "create",
"email": "user1@somecompany.com",
"password": "password",
"firstname": "firstname",
"lastname": "lastname",
"language": "fr",
"cellphone": "+37066111111",
"workphone": "+37066222222",
"license_type": "spaces_business"
}]
Example Response
If requested action is "merge" and user did not exist ("create" action was performed), endpoint returns
"action": "merge.create"
If requested action is "merge" and user existed ("update" action was performed), endpoint returns
"action": "merge.update"
{
"action": "create",
"status": "success",
"data": {
"id": "aghkZXZ-Tm9uZXIRCxIEVXNlchiAgICAoPSKCAw",
"username": "user1@somecompany.com",
"name": {
"familyname": "lastname",
"formatted": "",
"givenname": "firstname",
"honorific_prefix": "",
"honorific_suffix": "",
"middlename": "",
"pronunciation": "",
"pronunciation_url": ""
},
"last_login": null,
"date_joined": "2021-09-07T08:17:42.936000",
"lastmodifiedversion": "2021-09-07T08:17:45.350000",
"user_action_required": 0,
"emails": [{
"value": "user3@newcompany.com",
"type": "",
"primary": true,
"label": "",
"relationdef_id": "aghkZXZ-Tm9uZXIYCxILUmVsYXRpb25EZWYYgICAgKD0igoM"
}],
"languages ": [{
"code": "fr-FR",
"primary": true
}],
"timezone": "",
"picture_url": "http://localhost:9000/norevimages/noimage.jpg",
"relation_graphs": [{
"relationdef_id": "aghkZXZ-Tm9uZXIYCxILUmVsYXRpb25EZWYYgICAgKD0igoM",
"initiator_id": "aghkZXZ-Tm9uZXIUCxIHQ29tcGFueRiAgICAgOqUCQw",
"initiator_type": "company",
"relation_type": "employee"
}],
"phone_numbers": [{
"value": "+37066222222",
"type": "work",
"canonicalForm": "+37066222222",
"primary": true,
"verified": false,
"identity": false,
"login": false,
"unique": false,
"qualified_method": "",
"verify_method": "",
"verified_on": null,
"private_num": false,
"formattedType": "Work"
},
{
"value": "+37066111111",
"type": "mobile",
"canonicalForm": "+37066111111",
"primary": false,
"verified": false,
"identity": false,
"login": false,
"unique": false,
"qualified_method": "",
"verify_method": "",
"verified_on": null,
"private_num": true,
"formattedType": "Mobile"
}
],
"addresses": [],
"gender": "",
"displayname": "firstname lastname",
"permissions": [
],
"licenses": [{
"purchased_license_id": "aghkZXZ-Tm9uZXIdCxIQUHVyY2hhc2VkTGljZW5zZRiAgICAgL_vCAw",
"service_type": "zangspaces_business",
"product_type": "zangspaces",
"expiration": "2022-02-01T09:00:00",
"parentid": "aghkZXZ-Tm9uZXIUCxIHQ29tcGFueRiAgICAgOqUCQw",
"parent_type": "company",
"trial": false,
"allocated": "2021-09-07T08:17:46.713000",
"parent_displayname": "new_company"
}]
}
}
Errors
General errors
Response example:
{
"error": {
"message": "User bulk API invalid data: list required",
"code": "user_bulk.list_required"
}
}
Error code | Response code | Error message | Description |
---|
user_bulk.list_required | 400 | User bulk API invalid data: list required | API expects array, but got another type |
user_bulk.data_empty | 400 | User bulk API invalid data: list is empty | Got empty array |
user_bulk.limit_exceed | 400 | User bulk API request data limit exceeded | Request body objects limit exceeded (10) |
service_app.scope_required | 403 | No required scope configured for service app | Service app must have scope for this endpoint("accounts.users.bulk.write") |
Field errors
Endpoint return errors for every object that does not fit requirements.
Error code is dot-separated location (field) and reason.
Example:
{
"action": "create",
"errors": [{
"message": "User already exists.",
"code": "email.user_exists"
}],
"status": "error"
}
Location (fields) | Error reason | Description |
---|
email | duplicate_address | Email address has already been used in this request. |
email | invalid_domain | User email does not match any of company's domain. |
action, license_type | invalid_choice | Invalid choice. |
email, password, firstname, lastname, workphone, cellphone | invalid_value | Invalid value. |
action, email, password (for "create" action only) | field_required | This field is required. |
email ("create") | user_exists | Can not create new user. User with this email already exists. |
email ("update", "delete") | user_does_not_exist | Can not update or delete user. User with this email does not exists. |
non_field_errors | displayname_too_long | User's display name ("firstname" + "lastname") is too long (greater than 380 characters). |
Warnings
Endpoint returns warnings if user was successfully created or updated but Spaces license can not be assigned.
For example:
{
"action": "create",
"status": "success",
"warnings": [{
"code": "license.assigning_error",
"message": "Can not assign "spaces_business" license to user"
}],
"data": {
},
}
Possible error codes are :
- "license.assigning_error" - Can not assign specific license to user.
- "license.not_found" - Company does not have Spaces license.