This API enables you to retrieve roles that can be assigned to other users on a resource.
FS says "This API will prevent user from assigning a role with higher power than that user has." Can a Get API be used for assigning roles also?
You must have a role with Read privilege on roles.
The syntax for calling this method is:
GET <Base_Url>/resource/{resourceId}/user/{userId}/roles
A sample API call is as follows:
GET https://123.123.123.123/vCenter-CB/api/resource/10/user/1/roles
This API does not take any request body parameters.
If successful, the API returns the following details.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
Roles/Role |
|
***need info |
***need info |
Represents the Role element |
Roles/Role/Name |
xs:string |
1 |
1 |
Name for the role. |
Roles/Role/Description |
xs:string |
1 |
1 |
An optional description for the role. |
Roles/Role/Privileges/Privilege |
|
|
|
Represents the role's privileges |
Roles/Role/Privileges/Privilege/@id |
xs:int |
1 |
unbounded |
ID of the role's privilege |
Privileges/Privilege |
|
1 |
unbounded |
Represents the Privilege element |
Privileges/Privilege/@id |
xs:int |
1 |
1 |
ID of the role's privilege (***how is this different from the privilege above?) |
Privileges/Privilege/Name |
xs:string |
1 |
1 |
Name of the privilege. |
Privileges/Privilege/Description |
xs:string |
1 |
1 | An optional description provided for the privilege. |
Privileges/Privilege/InheritedPrivileges/InheritedPrivilege |
|
|
***need info |
***need info |
Privileges/Privilege/InheritedPrivileges/InheritedPrivilege/@id |
xs:int |
0 |
1 |
ID of the privilege inherited (***from which privilege) |
A sample response is provided here.
The following table explains the error codes displayed by the API.
Error code |
Description |
VCENTER_COMMON_ERR_INSUFFICIENT_PERMISSION |
User does not have sufficient permissions for performing this operation. (***is permissions the same as privileges?) |
VCENTER_COMMON_ERR_USER_NOT_AUTHENTICATED |
User is not authenticated to perform this operation (***isn't this same as insufficient permissions? Or does it mean that User has not authenticated with vCenter Chargeback?) |
VCB_ERR_USER__NOT_FOUND |
No user exists with the given user ID. |
VCB_ERR_RESOURCE_NOT_FOUND |
No resource exists with the given Resource ID. |