5.5

Table Of Contents
Create a Role
An organization administrator can create a role by aggregating a set of rights in a Role element and
POSTing it to the organization's add URL for roles.
Prerequisites
Verify that you are logged in to the vCloud API as an organization administrator or system administrator.
Procedure
1 Create a Role element that defines the role with a name and a set of rights.
To get the RightReference objects that populate the Role, retrieve the administrative view of the cloud,
using a request like this one:
GET https://vcloud.example.com/api/admin
The VCloud element returned by this request includes a RightReferences element that contains
RightReference elements that show the name and href for each right defined in the cloud. For example:
<RightReference
type="application/vnd.vmware.admin.right+xml"
name="vApp: Copy"
href="https://vcloud.example.com/api/admin/right/4965b0e7-9ed8-371d-8b08-fc716d20bf4b" />
2 POST the Role element to the organization's add URL for roles.
See the request portion of “Example: Create a Role,” on page 231.
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 153. The rights associated with this new role are less comprehensive than those
associated with the built-in vApp Author role, but still include rights to perform many common vApp
operations.
NOTE This example uses href attributes that contain actual UUID values for specific rights, since these are
invariant across vCloud Director installations and releases.
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: Copy"
href="https://vcloud.example.com/api/admin/right/4965b0e7-9ed8-371d-8b08-
fc716d20bf4b" />
<RightReference
type="application/vnd.vmware.admin.right+xml"
Chapter 6 Creating and Managing Organizations
VMware, Inc. 231