7.2

Table Of Contents
Example: curl Command
The following example command string submits a request to assign the user tony in the domain
example.mycompany.com to the tenant administrator role. It provides empty braces for the required JSON
payload. See “Syntax for Searching LDAP or Active Directory for a User,” on page 29 for more information
about geing the user name and domain values.
curl --insecure -H "Content-Type: application/json"
-H "Authorization: Bearer $token"
"https://$host/identity/api/authorization/tenants/development/principals/
susan@example.mycompany.com/roles/CSP_TENANT_ADMIN/" --data "{}"
Example: JSON Output
If the command is successful, the HTTP response body is empty except for a 204 No Content status
statement.
Syntax for Displaying all Roles Assigned to a User
You can use the REST API identity service to display all of the roles assigned to a user.
Input
Use the supported input parameters to control the command output.
Parameter Description
URL hps://$host/identity/api/authorization/tenants/$tenantId/principals/$princi
palId/roles
$token Species a valid HTTP bearer token with necessary credentials.
$host Species the host name and fully qualied domain name or IP address of
the vRealize Automation identity server.
$tenantId Species the ID of the tenant.
principalId Species the ID of the user in the form name@domain.
Output
The command output contains property names and values based on the command input parameters.
Property Description
id Species the role ID.
name Species the role name.
description Species the role description.
status Species the status of this role.
assignedPermissions Species the set of permissions that are implied by this role assignment.
Example: curl Command
The following example command lists all the roles that are assigned to tony@example.mycompany.com.
curl --insecure -H "Content-Type: application/json"
-H "Authorization: Bearer $token"
https://$host/identity/api/authorization/tenants/development/principals/
tony@example.mycompany.com/roles
Chapter 3 REST API Use Cases
VMware, Inc. 31