Skip to main content

Users Rest API

Use these APIs to manage users. Most of these APIs are restricted to Cloud and Project Administrators.

info

Specify the role of the user performing the operation in the Authorization header. For more information, see How To Execute Rest API.

Users

Gets all the users.

  • This API can only be used by Cloud or Project Administrators.

  • If you are a Project Administrator, you get all the users in your project.

  • If you are a Cloud Administrator, you get all the users from all projects.

GET  /api/v1/users

Get Users Response

Response: Status 200 OK
{
"status": "SUCCESS",
"data": [
{
"id": 1,
"userName": "admin",
"firstName": "admin",
"lastName": "admin",
"email": "onlinecloud@example.com",
"created": 0,
"roles": {
"Admin": [
"Default"
]
},
"authenticationType": "BASIC",
"lastAuthentication": "2023-05-31T06:23:19.162Z"
},
{
"id": 2259682,
"userName": "user",
"firstName": "a",
"lastName": "a",
"email": "a@example.com",
"created": 1554116570247,
"roles": {
"User": [
"Default",
"project 585",
"newProject",
"Project0"
]
},
"authenticationType": "BASIC",
"lastAuthentication": "2020-10-25T04:56:17.037Z"
},
{
"id": 3537797,
"userName": "padmin",
"firstName": "padmin",
"lastName": "padmin",
"email": "padmin@example.com",
"created": 1581002512778,
"roles": {
"ProjectAdmin": [
"Default",
"project 434"
]
"User": [
"project 585"
]
},
"authenticationType": "BASIC",
"lastAuthentication": "2020-06-16T12:43:10.023Z"
},

New

Creates a new user. This API can only be used by Cloud or Project Administrators.

POST  /api/v1/users/new

Parameters

NameTypeMandatoryDescription
usernameStringYesUser identifier
firstNameStringYesUser's first name
lastNameStringYesUser's last name
emailStringYesUser's email address
projectIntegerNoProject id to add this user to.

If the parameter is not provided then the user is added to the Default project.

Note: A Cloud Administrator can only be added to the Default project.
roleStringYesUser's role. Allowed values:

* Admin (only a Cloud Administrator can add a Cloud Administrator permission)
* ProjectAdmin
* User
passwordStringNoUser's password.

The password must contain:

* 7-25 characters
* At least one uppercase letter
* At least one lowercase letter
* At least one digit.
* Only these characters: (a-z,A-Z,0-9,_,-,.,@,#,*,$,!,?,%,~,SPACE).

In addition, the password must not contain leading or trailing spaces.

Only a Cloud Administrator can specify a password.

If this is field is blank, a random password is generated.
authenticationTypeStringNoAuthentication type for user to log in. Allowed values:

* BASIC
* SSO
* TWO_FA

The default is BASIC.

Create User Response

{"status":"SUCCESS","data":{"notification":"\u003cp\u003eThe temporary password of the user is: \u003cb\u003eF2rhzN8\u003c/b\u003e\u003c/p\u003e\u003cp\u003ePlease provide this temporary password to the user \u003cb\u003etestqa\u003c/b\u003e by a secured way.\u003cbr/\u003eThe user should login with this password and change it.\u003c/p\u003e\u003cp\u003eThe temporary password is valid for the next 100 years.\u003c/p\u003e","id":"2263818","tempPassword":"F2rhzN8","users":"User added successfully"},"code":"OK"}


Delete

Deletes a user. This API can only be used by Cloud or Project Administrators.

POST  /api/v1/users/<userid>/delete

userid - ID of the user

Use users to get the User ID.

Deleting User Response

Response: Status 200 OK
{"status":"SUCCESS","data":{"users":"User deleted successfully"},"code":"OK"}

My-account-info

Gets user account info. The response contains:

  • Username
  • First Name
  • Last Name
  • Role
  • Project Details.

This API can be used by all Users.

GET  /api/v1/users/my-account-info

You either use a username and Password, or an access key. If you use a username and password and you have more than one project assigned, you must supply the projectName header with the request. Otherwise the API returns an error.

my-account-info Response

Response: Status 200 OK

{
"status": "SUCCESS",
"data": {
"username": "john_doe",
"firstName": "john",
"lastName": "doe",
"role": "User",
"project": {
"id": 5992,
"name": "demoProject",
"created": 1589198952204,
"notes": null
}
},
"code": "OK"
}

Assign

Assigns a user to one or more projects.

  • You must be a Cloud Administrator to use this API.
  • You cannot assign a Cloud Administrator or a cleanup user.
  • The projects to be assigned must not contain a cleanup project.
  • On a successful request, updated user details are returned as a JSON object.
POST  /api/v1/users/<userid>/projects/assign

userid - ID of the user

Parameters

NameTypeMandatoryDescription
projectIdNumberYesid of the Project to be assigned
roleStringNoRole in which the user has to be assigned. Valid values:

* Use
* ProjectAdmin

Default Value: User
allowToReserveDeviceBooleanNoIf true, the user can reserve a device.

If false, the user can not be able to reserve a device. Also all actions that require a reserved device are disabled unless an administrator reserves a device for the user.

The user can not reboot or cleanup a device in any case.

Default Value: True.

Sample Request

POST  /api/v1/users/130/projects/assign

The request body must be in form of JSON array.

[
{"projectId":4859109,"role":"User"},
{"projectId":4859999,"role":"User","allowToReserveDevice":"false"},
{"projectId":4859108,"role":"ProjectAdmin"},
{"projectId":4859110}
]

Response

Response: Status 200 OK
{
"status": "SUCCESS",
"data": {
"id": 4859106,
"userName": "testuser",
"firstName": "testuser",
"lastName": "testuser",
"email": "testuser@testuser.testuser",
"created": 1620624765847,
"authenticationType": "BASIC",
"lastAuthentication": null,
"projects": [
{
"id": 4859109,
"name": "maproject1",
"role": "User",
"allowToReserveDevice": true
},
{
"id": 4859108,
"name": "maproject",
"role": "ProjectAdmin",
"allowToReserveDevice": true
},
{
"id": 4859110,
"name": "maproject2",
"role": "User",
"allowToReserveDevice": true
},
{
"id": 4859999,
"name": "viewroject",
"role": "User",
"allowToReserveDevice": false
}
]
},
"message": "Projects were assigned successfully",
"code": "OK"
}

Unassign

Unassigns a user from one or more projects.

  • You must be a Cloud Administrator to use this API.

  • You cannot assign a Cloud Administrator or a cleanup user.

  • The projects to be assigned must not contain a cleanup project.

  • The user can be either user or Project Administrator.

  • On a successful request, updated user details are returned as a JSON object.

POST  /api/v1/users/<userid>/projects/unassign

userid - User ID of the user

Parameters

NameTypeMandatoryDescription
projectIds (body)NumberYesIDs of the Project to be assigned

Sample Request

POST  /api/v1/users/130/projects/unassign

The request body must be in form of JSON array. The sample values represent the project IDs that need to be removed from the user.

[
4859109,
4859108,
4859110,

]

Response

Response: Status 200 OK
{
"status": "SUCCESS",
"data": {
"id": 4859106,
"userName": "testuser",
"firstName": "testuser",
"lastName": "testuser",
"email": "testuser@testuser.testuser",
"created": 1620624765847,
"authenticationType": "BASIC",
"lastAuthentication": null,
"projects": []
},
"message": "Projects were unassigned successfully",
"code": "OK"
}