Share via


Retrieve Usage Data from a Resource Provider

 

Applies To: Windows Azure Pack

Retrieves usage data from a resource provider.

Request

Replace <UsageEndpoint> with the endpoint address for the Windows Azure Pack Custom Resource Provider usage REST API.

Method

Request URI

HTTP version

GET

https://<UsageEndpoint>/usage

HTTP/1.1

URI Parameters

The following table describes the URI parameters.

URI parameter

Description

lastID

The ID of the last record received by the usage collector. The lastID parameter is empty for the first request. This is an acknowledgement that the usage collector recognizes the previous records, and can therefore delete them.

BatchSize

The number of new records to send to the usage collector. The new records are those that follow the record identified by the lastID parameter. The resource provider can send a smaller batch than requested, but not a larger one.

Request Headers

The following table describes required and optional request headers.

Request header

Description

Authorization: Bearer

Required. The authorization bearer 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

EventId

Required. A unique identifier that represents each usage record. This value will match that of the lastID URI parameter.

ResourceId

Optional. If the resource provider has multiple resources for a single subscription and the usage is being aggregated a resource, this field can be used to specify the resource name. If the usage is being aggregated by subscription ID, this element is not used.

StartTime

Required. Indicates when the collection of usage data started.

EndTime

Required. Indicates when the collection of usage data ended.

ServiceType

Required. The tier of service consumed.

SubscriptionId

Required. The subscription identifier for which the usage data was collected. (GUID).

Properties

Optional. A dictionary of name-value pairs used to pass any additional information about the usage.

Resources

Required. A dictionary of name-value pairs that represents the resources allocated or consumed. For example, a SQL resource provider may have total space and database count as its metrics.

Remarks

Retrieve Usage Data from a Resource Provider is called periodically by the Usage Collector to collect the resource provider’s usage information. This information can be used to generate billing costs for resource provider usage. For more information, Custom Resource Provider Endpoints. For more information about the Windows Azure Pack Usage Service, see Windows Azure Pack Usage Service.

See Also

Windows Azure Pack Custom Resource Provider Usage REST API Reference