5.1

Table Of Contents
Procedure
1 Create a Role element that defines the role with a name and a set of rights.
To get the RightReference objects you will need to populate the Role, retrieve the administrative view of
the cloud, using a request like this one:
GET https://vcloud.example.com/api/admin
2 POST the Role element to the organization's add URL for roles.
See the request portion of “Example: Create a Role,” on page 190.
The server creates a Role element and returns its representation to the client.
Example: Create a Role
This example adds a role named vAppWrangler to the organization created in “Example: Create an
Organization,” on page 133. The response is a Role element, most of which does not appear in the example.
The response includes links that an administrator can use to edit or remove the role.
Request:
POST https://vcloud.example.com/api/admin/roles
Content-Type: application/vnd.vmware.admin.role+xml
...
<?xml version="1.0" encoding="UTF-8"?>
<Role name="vAppWrangler" xmlns="http://www.vmware.com/vcloud/v1.5">
<Description>Create and manage vApps</Description>
<RightReferences>
<RightReference
type="application/vnd.vmware.admin.right+xml"
name="vApp: View"
href="https://vcloud.example.com/api/admin/right/16"/>
<RightReference
type="application/vnd.vmware.admin.right+xml"
name="vApp: Power Operations"
href="https://vcloud.example.com/api/admin/right/9"/>
<RightReference
type="application/vnd.vmware.admin.right+xml"
name="vApp: Download"
href="https://vcloud.example.com/api/admin/right/11"/>
</RightReferences>
</Role>
Response:
201 Created
Content-Type: application/vnd.vmware.admin.role+xml
...
<Role
name="vAppWrangler"
id="urn:vcloud:role:102"
xmlns="http://www.vmware.com/vcloud/v1.5"
href="https://vcloud.example.com/api/admin/role/102" ...>
<Link
rel="edit"
type="application/vnd.vmware.admin.role+xml"
href="https://vcloud.example.com/api/admin/role/102"/>
<Link
vCloud API Programming Guide
190 VMware, Inc.