How to create a user with Web Services API

Document ID : KB000057526
Last Modified Date : 14/02/2018
Show Technical Document Details


What is the payload to create a new user?


The curl example below uses API Key authentication.?

Follow the same syntax after replacing placeholder _abc123 with a valid API Key of a user who has sufficient permissions (subscription or workspace admin) to create new users.
The payload must include required fields UserName and EmailAddress:

curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -d"{\"User\":{\"UserName\":\"\",\"EmailAddress\":\"\"}}"

NOTE: Username must be unique.
Usernames are unique across the entire Rally stack.
An attempt to create a new user with a username that already exists results in the following error:

{"CreateResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": ["Validation error: User.UserName conflicts with ", "Validation error: User.UserName conflicts with "], "Warnings": []}}

NOTE: Required fields must be set in the payload.
An attempt to create a new user without email address (as in this wrong example):

curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -d"{\"User\":{\"UserName\":\"\"}}"

results in the following error:

{"CreateResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": ["Validation error: User.EmailAddress should not be null"], "Warnings": []}}

If you want to create a user now but activate the user later, the payload can be modified to set?Disabled?attribute to?true:

curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -d"{\"User\":{\"UserName\":\"\",\"EmailAddress\":\"\",\"Disabled\":\"true\"}}"

If the operation is successful a full JSON of the newly created user will be returned in the terminal.
Here is a screenshot form the UI ?(Setup>Users tab) that shows the new user:

User-added image