ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

How to create a user with Web Services API

book

Article ID: 57526

calendar_today

Updated On:

Products

CA Agile Central On Premise (Rally) CA Agile Central SaaS (Rally) Rally Perpetual Hosted

Issue/Introduction

What is the payload to create a new user?

 

Resolution

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\":\"[email protected]\",\"EmailAddress\":\"[email protected]\"}}" https://rally1.rallydev.com/slm/webservice/v2.0/User/create

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 [email protected] ", "Validation error: User.UserName conflicts with [email protected] "], "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\":\"[email protected]\"}}" https://rally1.rallydev.com/slm/webservice/v2.0/User/create

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\":\"[email protected]\",\"EmailAddress\":\"[email protected]\",\"Disabled\":\"true\"}}" https://rally1.rallydev.com/slm/webservice/v2.0/User/create

If the operation is successful a full JSON of the newly created user will be returned in the terminal.

Here is a screenshot from the UI (Setup -> Users tab) that shows the new user:

 

Attachments

1558713219767000057526_sktwi1f5rjvs16sx5.png get_app