Share via


Retrieve the Usage Summary for a Subscription

 

Applies To: Windows Azure Pack

Called by the Service Management API to retrieve a summary of subscription usage data generated by a resource provider. This information can be used by a billing adapter to calculate billing costs. For more information, see Windows Azure Pack Usage Service.

Request

Replace <NotificationEndpoint> with the endpoint address for the Windows Azure Pack Custom Resource Provider Notification REST API. Replace <Id> with the identifier of the usage summary to be retrieved.

Method

Request URI

HTTP version

GET

http://<NotificationEndpoint>/subscriptions/<Id>/usagesummary

HTTP/1.1

URI Parameters

None.

Request Headers

The following table describes required and optional request headers.

Request header

Description

Authorization: Basic

Required. The basic authorization token.

x-ms-principal-id

Required. The principal identifier.

x-ms-client-request-id

Optional. The client request identifier.

x-ms-client-session-id

Optional. The client session identifier.

x-ms-principal-liveid

Optional. The principal Live identifier.

Request Body

None.

Response

The response includes an HTTP status code, a set of response headers, and a response body.

Status Code

A successful operation returns status code 200 (OK).

For information about status codes, see Status and Error Codes (Windows Azure Pack Service Management).

Response Headers

The response for this operation includes standard HTTP headers. All standard headers conform to the HTTP/1.1 protocol specification.

Response Body

The following table describes the key elements of the response body:

Element name

Description

ServiceUsageSummary

The retrieved usage summary. For more information, see ServiceUsageSummary (Notification Endpoint Object).

Example

The following code example shows a Get Subscription Usage Summary request.

GET https://<NotificationEndpoint>/subscriptions/685a05ed-3a6f-4c3a-b70c-924a1307834f/usagesummary HTTP/1.1
Referer: https://<Computer>:30004/subscriptions/685a05ed-3a6f-4c3a-b70c-924a1307834f/usagesummaries
Accept: application/json
Accept-Language: en-US
x-ms-client-request-id: 82610bdb-14d6-4e2a-99a0-9930d879b300-2013-07-25 06:14:56Z
x-ms-client-session-id: be02e255-38de-4e86-9690-b3a3e3037e4c
x-ms-principal-id: <COMPUTER>\Administrator
x-ms-principal-liveid: <COMPUTER>\Administrator
x-ms-request-id: 37739ad5c7ab4654b6bb5d5e211f974e.2013-07-25T06:14:57.7649169Z
Authorization: Basic <encoded username and password>
Host: <Computer>:30010

The following code example shows a Get Subscription Usage Summary JSON response.

{
  "ServiceName": "SqlServer",
  "ServiceDisplayName": "Sql Server",
  "RetrievedSuccessfully": false,
  "ErrorMessage": null,
  "Usages": [

  ]
}

Remarks

When calling TBD, the Service Management API waits one minute for a response. If no response is received the subscription is marked as being out of synchronization.

See Also

Windows Azure Pack Custom Resource Provider Notification REST API Reference