Account operations

The operations described in this section enable you to perform accounts operations.

Get billing account

GET /v2/accounts/{ran}

Get a billing account.

Request

The request has the following URI and header parameters:

NameTypeDescription
{ran}URI string (Required)A billing account number.
X-Auth-TokenHeader string (Required)A valid authentication token associated with the particular role.
AcceptHeader stringValue: application/json

This operation does not accept a request body.

Response

Example Get billing account - Cloud: JSON response

{
  "billingAccount": {
    "accountNumber": "{ran}",
    "currency": "USD",
    "monthlyRecurringRevenue": "100.00",
    "name": "amazon",
    "link": [
     {
        "rel": "balance",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/balance"
      },
      {
        "rel": "billing-summary",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/billing-summary"
      },
      {
        "rel": "latestInvoice",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/invoices/latest"
      },
      {
        "rel": "estimated_charges",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/estimated_charges"
      }
    ]
  }
}

Sample JSON for a dedicated parent billing account:

If the billingAccount in the request is a parent billing account, the childCount is included in the response, indicating the number of child billing accounts.

The following sample shows a partial response for a dedicated parent billing account.

{
  "billingAccount": {
    ...
    ...
    ...
    "childCount": 5,
    "accountNumber": "{ran}",
    "name": "amazon",
    "link": [
         {
             "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}/accounts",
             "rel": "childBillingAccounts"
         },
         ...
         ...
         ...
    ]
  }
}

Sample JSON for a dedicated child billing account:

If the billingAccount in the request is a child billing account, the parentAccountNumber is included in the response.

The following sample shows a partial response for a dedicated child billing account.

{
  "billingAccount": {
    ...
    ...
    ...
    "accountNumber": "{ran}",
    "parentAccountNumber": "{parentRan}",
    "name": "amazon"
  }
}

This table shows the possible response codes for this operation:

Response codeNameDescription
200OKThe request succeeded.
400Bad RequestA general error has occurred.
401UnauthorizedThe request has not been applied because it lacks valid authentication credentials for the target resource. The credentials are either expired or invalid.
404Not FoundThe server could not find what was requested.
405Method Not AllowedThe method received in the request line is known by the origin server but is not supported by the target resource.
406Not AcceptableThe server cannot produce a response matching the list of acceptable values defined in the request.
415Unsupported Media TypeThis error might result if the wrong media type is used in the cURL request.
500Internal Server ErrorThe server encountered an unexpected condition that prevented it from fulfilling the request.

Users with the following roles can access this API:

  • identity:user-admin
  • admin
  • billing:admin
  • observer
  • billing:observer

Get child billing accounts

GET /v2/accounts/{ran}/accounts

Gets a list of child billing accounts.

Request

The request has the following URI and header parameters:

NameTypeDescription
{ran}URI string (Required)A billing account number.
X-Auth-TokenHeader string (Required)A valid authentication token associated with the particular role.
AcceptHeader stringValue: application/json

This table shows the query parameters for the request:

NameTypeDescription
limitIntegerAn integer between 1 and 200 to specify the number of records to return. The default limit is 25 records. To learn more about pagination rules, refer to section Paginated Collections.
markerIntegerAn integer between 0 and the last item of the result list.

This operation does not accept a request body.

Response

Example Get a list of child billing accounts: JSON response

{
  "billingAccounts": {
    "link": [
      {
        "rel": "prev",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts?marker=0&limit=10"
      },
      {
        "rel": "next",
        "href": "https://billing.api.rackspacecloud.com/v2/accounts?marker=0&limit=10"
      }
    ],
    "total": 2,
    "billingAccount": [
      {
        "link": [
          {
            "rel": "self",
            "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}"
          }
        ],
        "currency": "USD",
        "accountNumber": "{ran}",
        "parentAccountNumber": "{parentRan}",
        "name": "amazon"
      },
      {
        "link": [
          {
            "rel": "self",
            "href": "https://billing.api.rackspacecloud.com/v2/accounts/{ran}"
          }
        ],
        "currency": "USD",
        "accountNumber": "{ran}",
        "parentAccountNumber": "{parentRan}",
        "name": "amazon"
      }
    ]
  }
}

This table shows the possible response codes for this operation:

Response codeNameDescription
200OKThe request succeeded.
400Bad RequestA general error has occurred.
401UnauthorizedThe request has not been applied because it lacks valid authentication credentials for the target resource. The credentials are either expired or invalid.
404Not FoundThe server could not find what was requested.
405Method Not AllowedThe method received in the request line is known by the origin server but is not supported by the target resource.
406Not AcceptableThe server cannot produce a response matching the list of acceptable values defined in the request.
415Unsupported Media TypeThis error might result if the wrong media type is used in the cURL request.
500Internal Server ErrorThe server encountered an unexpected condition that prevented it from fulfilling the request.

Users with any of the following roles can access this API:

  • identity:user-admin
  • admin
  • billing:admin
  • observer
  • billing:observer

Get billing account currency

GET /v2/accounts/{ran}/currency

Get a billing account currency.

Request

The request has the following URI and header parameters:

NameTypeDescription
{ran}URI string (Required)A billing account number.
X-Auth-TokenHeader string (Required)A valid authentication token associated with the particular role.
AcceptHeader stringValue: application/json

This operation does not accept a request body.

Response

Example Get billing account currency: JSON response

{
   "billingAccount": {
      "currency": "USD",
      "link": []
   }
}

This table shows the possible response codes for this operation:

Response codeNameDescription
200OKThe request succeeded.
400Bad RequestA general error has occurred.
401UnauthorizedThe request has not been applied because it lacks valid authentication credentials for the target resource. The credentials are either expired or invalid.
404Not FoundThe server could not find what was requested.
405Method Not AllowedThe method received in the request line is known by the origin server but is not supported by the target resource.
406Not AcceptableThe server cannot produce a response matching the list of acceptable values defined in the request.
415Unsupported Media TypeThis error might result if the wrong media type is used in the cURL request.
500Internal Server ErrorThe server encountered an unexpected condition that prevented it from fulfilling the request.

Users with any of the following roles can access this API:

  • identity:user-admin
  • admin
  • billing:admin
  • observer
  • billing:observer

Get next due date

GET /v2/accounts/{ran}/futureBill

Retrieves the due date of the first future bill for the current payment term.

Request[

The request has the following URI and header parameters:

NameTypeDescription
{ran}URI string (Required)A billing account number.
X-Auth-TokenHeader string (Required)A valid authentication token associated with the particular role.
AcceptHeader stringValue: application/json

This operation does not accept a request body.

Response

Example Get next due date: JSON response

{
  "futureBill": {
    "nextDueDate": "2015-10-26T19:00:00.000-05:00"
  }
}

This table shows the possible response codes for this operation:

Response codeNameDescription
200OKThe request succeeded.
400Bad RequestA general error has occurred.
401UnauthorizedThe request has not been applied because it lacks valid authentication credentials for the target resource. The credentials are either expired or invalid.
404Not FoundThe server could not find what was requested.
405Method Not AllowedThe method received in the request line is known by the origin server but is not supported by the target resource.
406Not AcceptableThe server cannot produce a response matching the list of acceptable values defined in the request.
415Unsupported Media TypeThis error might result if the wrong media type is used in the cURL request.
500Internal Server ErrorThe server encountered an unexpected condition that prevented it from fulfilling the request.

Users with any of the following roles can access this API:

  • identity:user-admin
  • admin
  • billing:admin
  • observer
  • billing:observe