Page tree
Skip to end of metadata
Go to start of metadata

Digital.ai Continuous Testing enables Cloud and Project Admins to manage users using Rest API. This page describes supported RestAPI'sfor managing users.

The role of the user performing the Rest Operation is specified by the Authorization header.

For more information, please visit How To Execute Rest API.

Gets All the Users

Gets all the users.

  • This API can only be used by Cloud Admins or Project Admins.
  • Project Admin will get all the users in his project.
  • Cloud Admin will 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@experitest.com",
            "created": 0,
            "role": "Admin",
            "authenticationType": "BASIC",
            "lastAuthentication": "2019-12-23T10:20:57.291Z"
        },



Creating New Users

Creating new users via the cloud requires Project Admin or Cloud Admin permissions.

  • This API can only be used by Cloud Admins or Project Admins.
POST  /api/v1/users/new


Parameters

Name

Type

Mandatory

Description

usernameStringYesIdentifier of the user
firstNameStringYesFirst name of the user
lastNameStringYesLast name of the user
emailStringYesEmail of the user
projectIntegerNo

Project id to add this user to

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

Note: Cloud Admin can only be added to the Default project.

roleStringYes
  • Admin (required Cloud Admin permission)
  • ProjectAdmin
  • User
passwordStringNo

The password must be between 7-25 characters, at least one uppercase letter,

at least one lowercase letter, and at least one digit. The password must contain only valid

characters (a-z,A-Z,0-9,_,-,.,@,#,*,$,!,?,%,~,SPACE). The password must not contain leading or trailing spaces.

Only Admin role can use this option, the blank password will do the same process of generating a random password.

authenticationTypeStringNoAuthentication type for user to log in.
  • BASIC
  • SSO
  • TWO_FA
If the parameter is not provided then authentication type will be 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"}


Deleting a User

Deletes a user in the cloud, required Project Admin or Cloud Admin permission.

  • This API can only be used by Cloud Admin or Project Admin.
POST  /api/v1/users/{userid}/delete

{userid} - userid of the user

Note: userid can be retrieved using Get users Rest API.

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

Getting User Account Info

Get User account info. The response contains Username, First Name, Last Name, Role and Project Details.

  • This API can be used by all Users.

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

This API can be accessed by Username/Password or Access key. If Username/Password is used to access the API, and the user has more than one project assigned, then the projectName header must be supplied with the request, else the API will return an error.

The API response is as follows:

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 User to Multiple Projects

Cloud admin can assign an user to multiple projects in a single API call.

  • This API can be used by only Cloud Admin
  • The user to be assigned must not be cloud admin or cleanup user
  • The projects to be assigned must not contain cleanup project
  • On a successful request, updated user details are returned as json object

POST  /api/v1/users/{userid}/projects/assign

{userid} - User ID of the user

Parameters

Name

Type

Mandatory

Description

projectId NumberYesid of the Project to be assigned
roleStringNo

Role in which the user has to be assigned valid values are: User, ProjectAdmin

Default Value: User

allowToReserveDeviceBooleanNo

Can be false only for User role, when false the user will not be able to reserve a device.

Also all actions that require a reserved device will be disabled unless an admin will reserve a device for the user.

The user will not be able to 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 as demonstrated below:

[
{"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"
}


Unassigning Users From Multiple Projects

Cloud admin can unassign any user from multiple projects – in a single API call.

  • This API can be used by only Cloud Admin
  • The user to be unassigned must not be cloud admin or cleanup user
  • The projects to be unassigned must not contain cleanup project
  • The user can be either user or project Admin
  • On a successful request, updated user details are returned as json object

POST  /api/v1/users/{userid}/projects/unassign

{userid} - User ID of the user

Parameters

Name

Type

Mandatory

Description

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 as given below. The sample values represent the project ids that needs 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"
}










  • No labels