POST/depts/{DeptId}/users

Applies to QAComplete 12.84 SaaS, last modified on July 19, 2021

Adds a new user inside a specified department.

Use this operation to add a new user to a specified department in QAComplete.

To replace an existing user, use the /depts/{DeptId}/users/{UserId} (PUT) operation.

You cannot set a password for the newly created user with this method. To set a password, a new user should click Forgot Password on a QAComplete logon screen.

Authentication

Basic authentication using a user’s login and password. See Authentication for details.

Security Rights

The authenticating user must have administrator privileges.

Request Format

To add a user to the department, send a POST request to the following URL:

http://{server}/rest-api/service/api/v1/depts/{DeptId}/users
URL parameters

DeptId  :  integer, required

The ID of the needed department.

Body parameters

In the request body, pass the RequestUserPost object that contains data about the user to create.

{
  "LastName": "string",
  "FirstName": "string",
  "MiddleName": "string",
  "Email": "string",
  "TimeZone": "string",
  "IsSecurityAdmin": boolean,
  "Phone": "string",
  "CompanyName": "string",
  "IsAdAccount": boolean,
  "AdSearchValue": "string",
  "Custom1": "string",
  "Custom2": "string",
  "Custom3": "string",
  "Custom4": "string",
  "Custom5": "string",
  "Custom6": "string",
  "Custom7": "string",
  "Custom8": "string",
  "Custom9": "string",
  "Custom10": "string",
}

LastName  :  string, required

The last name of the user to create.

FirstName  :  string, required

The first name of the user to create.

MiddleName  :  string

The middle name of the user to create.

Email  :  string, required

An email of the user to create.

TimeZone  :  string

A time zone of the user to create.

IsSecurityAdmin  :  boolean

True if the newly created user will be a security administrator, False otherwise.

Phone  :  string

A phone number of the user to create.

CompanyName  :  string

A company of the user to create.

IsAdAccount  :  boolean

True if the newly created user will use an Active Directory account, False otherwise.

AdSearchValue  :  string

An Active Directory search value for the newly created user.

Custom[1-10]  :  string

A custom field.

A sample request:

POST http://yourserver.com/rest-api/service/api/v1/depts/8162/users HTTP/1.1
Host: yourserver.com
Connection: keep-alive
Content-Type: application/json
Accept: application/json
Authorization: Basic am9obkBleGFtcGxlLmNvbTpwQHNzd29yZA==
Content-Length: 80

{
  "LastName": "Doe",
  "FirstName": "John",
  "Email": "johndoe@example.com"
}

A sample request made by using cURL:

curl -i john@example.com:p@ssword -F @user.txt -H "Content-type: application/json" -H "Accept: application/json" http://yourserver.com/rest-api/service/api/v1/projects/8162/users

Response Format

If successful, the operation responds with HTTP status code 200. The response is a JSON object with information on the newly created user.

A sample response:

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Length: 507


{
"id": 24793,
"first_name": "John",
"last_name": "Doe",
"email": "johndoe@example.com",
"is_logged_on": false,
"is_security_admin": false,
"is_active": true,
"nbr_times_logon": 0,
"date_of_anniv": "1900-01-01T00:00:00.0000000",
"is_selected": false,
"update_user_id": 0,
"date_created": "2016-01-01T00:00:00.0000000",
"date_updated": "2016-01-01T00:00:00.0000000",
"discount": 0,
"import_id": 0,
"primary_dept_id": 8162,
"logon_attempts": 0,
"is_a_d_account": false
}

Error responses

If the operation fails, it returns the appropriate status code and (optionally) the error description in the response body.

See Also

Users REST API Reference

Highlight search results