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 totrue
.
This table shows the possible response codes for this operation:
Response Code | Name | Description |
---|---|---|
200 | OK | The request completed successfully. |
400 | Bad Request | The request is missing one or more elements, or the values of some elements are invalid. |
401 | Unauthorized | You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 | Forbidden | The 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. |
404 | Not Found | The requested resource was not found. |
405 | Invalid Method | The method specified in the request is not valid for the resource identified in the request URI. |
413 | Over Limit | The number of items returned is above the allowed limit. |
503 | Service Fault | Service is not available. |
Request
This table shows the URI parameters for the request:
Name | Type | Description |
---|---|---|
name | String (Required) | The name of the tenant. |
X-Auth-Token | String (Required) | A valid authentication token issued to a user with administrative privileges. |
This table shows the query parameters for the request:
Name | Type | Description |
---|---|---|
apply_rcn_roles | Boolean (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:
Name | Type | Description |
---|---|---|
tenants | String | The tenants object returns the collection of tenant resources that the authenticated user has permission to view. |
tenants.tenant | The tenant object returns the following tenant account information: name, tenant id, account status, and description. | |
tenant.id | String (Required) | The unique, system-generated ID that identifies the in the Rackspace system. |
tenant.enabled | Boolean | Indicates whether the tenant is currently active for use with the Rackspace Cloud. |
tenant.display-name | String | The name to display in user interfaces if it has been specified. |
tenant.description | String | Describes the tenant tenant account i if specified. |
tenant.name | String | The 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 code | Name | Description |
---|---|---|
200 | OK | The request has been fulfilled. The users for tenant have been retrieved. |
400 | Bad Request | The request is missing one or more elements, or the values of some elements are invalid. |
401 | Unauthorized | You are not authorized to complete this operation. This error can occur if the request is submitted with an invalid authentication token. |
403 | Forbidden | The 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. |
404 | Not Found | The requested resource was not found. |
405 | Invalid Method | The method specified in the request is not valid for the resource identified in the request URI. |
406 | Not Acceptable | The server cannot send data in a format requested. |
413 | Over Limit | The number of items returned is above the allowed limit. |
503 | Service Fault | Service is not available. |
Request
This table shows the header parameters for the request:
Name | Type | Description |
---|---|---|
X-Auth-Token | String (Required) | A valid authentication token. |
This operation does not accept a request body.
Response
This table shows the URI parameters for the request:
Name | Type | Description |
---|---|---|
{tenantId} | String | The unique ID assigned to the tenant account. |
This table shows the query parameters for the request:
Name | Type | Description |
---|---|---|
roleId | String (Optional) | Filter users with role for tenant. Mutually exclusive with contactId query parameter. |
contactId | String (Optional) | Filter users with contact ID for tenant. Mutually exclusive with roleId query parameter. |
marker | Object (Optional) | Allows us to page through list of users for a tenant. This is the numeric ID of the item to start the list. |
limit | Object (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]"
}
]
}