This API enables you to retrieve roles that can be assigned to other users on a resource.
You must have read privilege on User ID and read privilege on Resource ID.
The syntax for calling this method is:
PUT <Base_Url>/user/{userId}/assignableRoles
A sample API call is as follows:
PUT https://123.123.123.123/vCenter-CB/api/user/1/assignableRoles
The request XML for this API contains the following parameters .
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
Resources/Resource |
|
1 |
unbounded |
Represents the resources. |
Resources/Resource/@id |
xs:int |
1 |
1 |
ID of the resource for which the assignable roles you want to retrieve. |
A sample response is provided here.
If successful, the API returns the following details.
XPath |
Type |
Min Occurs |
Max Occurs |
Description |
---|---|---|---|---|
Users/User |
|
1 |
1 |
This is the user element. |
Users/User/@id |
xs:string |
1 |
1 |
ID of the user. |
Users/User/Name |
xs:string |
1 |
1 |
Name of the user. |
Roles/Role |
|
1 |
1 |
This is the role element. |
Roles/Role/@id |
xs:int |
1 |
1 |
ID of the user role. |
Roles/Role/Name |
xs:string |
1 |
1 |
Name of the user role. |
Roles/Role/Description |
xs:string |
1 |
1 |
Description provided for the user role. |
Roles/Role/Custom |
xs:boolean |
|
|
Indicates whether the role is a custom role. |
Roles/Role/Privileges/Privilege |
|
1 |
unbounded |
This is privilege element. |
Roles/Role/Privileges/Privilege/@id |
xs:int |
1 |
1 |
The unique ID of the privilege the user role is assigned. |
Resources/Resource/ |
|
|
|
Represents the Resources. |
Resources/Resource/@id |
xs:int |
1 |
1 |
ID of the resource. |
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. |
VCENTER_COMMON_ERR_USER_NOT_AUTHENTICATED |
User is not authenticated to perform this operation |
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. |