Add User to Workspace
API Explorer: /workspaces/{workspaceId}/users
To add a user to a workspace, you need the workspaceId of the workspace you want to add the user to and use an API key that has account admin access or a workspace manager role. For the sample code on the right, workspaceId 123456 has added user myName@myDomain.com to the workspace with the workspace manager role.
If you do not know the workspaceId of the workspace, use List Workspaces to return a list of your workspaces.
Add User to Workspace
curl 'https://a.blazemeter.com/api/v4/workspaces/123456/users' \
-X POST \
-H 'Content-Type: application/json' \
--user 'api_key_id:api_key_secret' \
-d '{"usersIds":[352749],"roles": ["manager"]}'
Add User to Workspace Request Attributes
Attributes
-
usersIdsarrayrequired
The
userIds of the user(s) you want to add as aninteger -
rolesarrayrequired
An array of workspace roles that will be assigned to the user. Only ONE role should be assigned for any user. The following are the available roles:
tester- Workspace tester rolemanager- Workspace manager roleviewer- Workspace viewer role
The following JSON sample provides a more readable version of the content contained in the above curl example. This example represents the attributes and values contained in the -d flag of the curl example.
Add User to WorkspaceAdd User to Workspace POST Body (JSON)
{
"usersIds": [
352749
],
"roles": [
"manager"
]
}
Add User to Workspace Response Attributes
All timestamps are in UNIX Epoch time.
Attributes
-
idintegerread-only
The unique identifier for the user. Also know as a
userId -
rolesarrayThe roles assigned to this user. Can be ONE of the following:
tester- Workspace tester rolemanager- Workspace manager roleviewer- Workspace viewer role -
enabledbooleanDenotes if the user is enabled or not in the workspace
-
lastAccessintegerread-only
The timestamp of when the user last accessed the workspace
-
typestringread-only
The level of the user. Will alwasy be
workspacefor this case -
displayNamestringread-only
The display name for the user
-
firstNamestringread-only
The first name of the user
-
lastNamestringread-only
The last name of the user
-
loginintegerread-only
The timestamp of the last login for this user
-
emailstringThe email address of this user
-
accessintegerread-only
The timestamp of the last access for this user
Response201 Created
{
"api_version": 4,
"error": null,
"result": [
{
"id": 123456,
"roles": [
"manager"
],
"enabled": true,
"lastAccess": 1573503678,
"type": "workspace",
"memberId": {
"$oid": "5dc9c2be4b5cab1c82345bb3"
},
"displayName": "Standard Manager",
"firstName": "Standard",
"lastName": "Manager",
"login": 1570322423,
"email": "myName@myDomain.com",
"access": 1573503678
}
],
"request_id": "5dc9c2be0ae5a"
}