Use the List tenant API operation to retrieve information about Rackspace Cloud tenants. Tenant IDs are assigned when a Rackspace Cloud account is created.

List tenants

GET /v2.0/tenants

Get a list of tenants.

The list of tenants returned includes only those to which the user has access, based on the user’s X-Auth-token. The tenants to which the user has access via RCN roles are returned only if requested.

Note

  • The list tenants operation can be made by any users with an Identity role.
  • Tenants associated to a user via an RCN role will be returned only when apply_rcn_roles query parameter is set to true.

This table shows the possible response codes for this operation:

Response CodeNameDescription
200OKThe request completed successfully.
400Bad RequestThe request is missing one or more elements, or the values of some elements are invalid.
401UnauthorizedYou are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token.
403ForbiddenThe request was valid, but the server is refusing to respond because you do not have permission to access the requested resource. Submit a request to your account administrator to determine how to gain access.
404Not FoundThe requested resource was not found.
405Invalid MethodThe method specified in the request is not valid for the resource identified in the request URI.
413Over LimitThe number of items returned is above the allowed limit.
503Service FaultService is not available.

Request

This table shows the URI parameters for the request:

NameTypeDescription
nameString (Required)The name of the tenant.
X-Auth-TokenString (Required)A valid authentication token issued to a user with administrative privileges.

This table shows the query parameters for the request:

NameTypeDescription
apply_rcn_rolesBoolean (Optional)When true, include any tenants to which the user has access due to RCN roles. Defaults to false.

This operation does not accept a request body.

Response

This table shows the body parameters for the response:

NameTypeDescription
tenantsStringThe tenants object returns the collection of tenant resources that the authenticated user has permission to view.
tenants.tenantThe tenant object returns the following tenant account information: name, tenant id, account status, and description.
tenant.idString (Required)The unique, system-generated ID that identifies the in the Rackspace system.
tenant.enabledBooleanIndicates whether the tenant is currently active for use with the Rackspace Cloud.
tenant.display-nameStringThe name to display in user interfaces if it has been specified.
tenant.descriptionStringDescribes the tenant tenant account i if specified.
tenant.nameStringThe answer that the user can provide to verify an account.

Example: List tenants response XML

HTTP/1.1 200 OK
Content-Type: application/xml; charset=UTF-8
Content-Length: 200
Date: Sun, 1 Jan 2011 9:00:00 GMT

<?xml version="1.0" encoding="UTF-8"?>
<tenants
   xmlns="http://docs.openstack.org/identity/api/v2.0"
   xmlns:OS-KSADM="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
   xmlns:atom="http://www.w3.org/2005/Atom">
   <tenant display-name="Star Wars" enabled="true" id="5781234" name="star_wars">
     <description>Used to manage the Star Wars games</description>
   </tenant>
   <tenant display-name="Star Wars" enabled="true" id="5781234_FS" name="start_wars_pictures">
     <description>Used to manage the pictures for Star Wars</description>
   </tenant>
 </tenants>

Example: List tenants response JSON

{
  "tenants": [
    {
      "id": "5784574",
      "enabled": true,
      "display-name": "Star Wars",
      "description": "Used to manage the Star Wars games",
      "name": "star_wars"
     },
    {
      "id": ""5781234_FS",
      "enabled": true,
      "display-name": "Star Wars",
      "description": "Used to manage the pictures for Start Wars",
      "name": "start_wars_pictures"
    }
   ]
}

List users for tenant

GET /v2.0/tenants/{tenantId}/users

Lists all users for a tenant.

Note

  • Page query parameters are ignored when using contactId query parameter.

This table shows the possible response codes for this operation:

Response codeNameDescription
200OKThe request has been fulfilled. The users for tenant have been retrieved.
400Bad RequestThe request is missing one or more elements, or the values of some elements are invalid.
401UnauthorizedYou are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token.
403ForbiddenThe request was valid, but the server is refusing to respond because you do not have permission to access the requested resource. Submit a request to your account administrator to determine how to gain access.
404Not FoundThe requested resource was not found.
405Invalid MethodThe method specified in the request is not valid for the resource identified in the request URI.
406Not AcceptableThe server cannot send data in a format requested.
413Over LimitThe number of items returned is above the allowed limit.
503Service FaultService is not available.

Request

This table shows the header parameters for the request:

NameTypeDescription
X-Auth-TokenString (Required)A valid authentication token.

This operation does not accept a request body.

Response

This table shows the URI parameters for the request:

NameTypeDescription
{tenantId}StringThe unique ID assigned to the tenant account.

This table shows the query parameters for the request:

NameTypeDescription
roleIdString (Optional)Filter users with role for tenant. Mutually exclusive with contactId query parameter.
contactIdString (Optional)Filter users with contact ID for tenant. Mutually exclusive with roleId query parameter.
markerObject (Optional)Allows us to page through list of users for a tenant. This is the numeric ID of the item to start the list.
limitObject (Optional)Allows us to set size of page when paging through list of users for a tenant. This is the number of items per page.

Response:

Example: List users for tenant XML response

<?xml version="1.0" encoding="UTF-8"?>
<users
      xmlns="http://docs.openstack.org/identity/api/v2.0"
      xmlns:OS-KSADM="http://docs.openstack.org/identity/api/ext/OS-KSADM/v1.0"
      xmlns:atom="http://www.w3.org/2005/Atom">
      <user
            email="[email protected]"
            enabled="true" id="123456"
            username="jqsmith"/>

      <user email="[email protected]"
            enabled="true" id="388493"
            username="miketurner"/>

      <user email="[email protected]"
            enabled="false"
            id="938439"
            username="poejo"/>
</users>

Example: List users for tenant JSON response

{
  "users": [
    {
      "id": "123456",
      "enabled": true,
      "username": "jqsmith",
      "email": "[email protected]"
    },
    {
      "id": "388493",
      "enabled": true,
      "username": "miketurner",
      "email": "[email protected]"
    },
    {
      "id": "938439",
      "enabled": false,
      "username": "poejo",
      "email": "[email protected]"
    }
  ]
}