Get Role for a User on a Resource

This API helps you retrieve a role assigned to a user on a resource.

User Privileges Required

You must have a role with Read privilege on the user ID and the resource ID.

Syntax

The syntax for calling this method is:

GET <Base_Url>/resource/{resourceId}/user/{userId}/role

A sample API call is as follows:

GET https://123.123.123.123/vCenter-CB/api/resource/10/user/user1/role

Request Body Parameters

This API does not take any request XML.

API Response

If the operation is successful, the API gets an XML response with 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.

Error Response

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_ROLE_NOT_FOUND

No role exists with the given Role ID.

VCB_ERR_RESOURCE_NOT_FOUND

No resource exists with the given Resource ID.