Get all Azure usage analytics information
Applies to: Partner Center | Partner Center operated by 21Vianet | Partner Center for Microsoft Cloud for US Government
How to get all the Azure usage analytics information for your customers.
Prerequisites
- Credentials as described in Partner Center authentication. This scenario supports authentication with User credentials only.
REST request
Request syntax
Method | Request URI |
---|---|
GET | {baseURL}/partner/v1/analytics/usage/azure HTTP/1.1 |
URI parameters
Parameter | Type | Description |
---|---|---|
top | string | The number of rows of data to return in the request. The maximum value and the default value if not specified is 10000. If there are more rows in the query, the response body includes a next link that you can use to request the next page of data. |
skip | int | The number of rows to skip in the query. Use this parameter to page through large data sets. For example, top=10000 and skip=0 retrieves the first 10000 rows of data, top=10000 and skip=10000 retrieves the next 10000 rows of data, and so on. |
filter | string | The filter parameter of the request contains one or more statements that filter the rows in the response. Each statement contains a field and value that are associated with the eq or ne operators, and statements can be combined using and or or . You can specify the following strings:customerTenantId customerName subscriptionId subscriptionName usageDate resourceLocation meterCategory meterSubcategory meterUnit Example: .../usage/azure?filter=meterCategory eq 'Data Management' Example: .../usage/azure?filter=meterCategory eq 'Data Management' or (usageDate le cast('2018-01-01', Edm.DateTimeOffset) and usageDate le cast('2018-04-01', Edm.DateTimeOffset)) |
aggregationLevel | string | Specifies the time range for which to retrieve aggregate data. Can be one of the following strings: day , week , or month . If unspecified, the default is day .The aggregationLevel parameter isn't supported without a groupby . The aggregationLevel parameter applies to all date fields present in the groupby . |
orderby | string | A statement that orders the result data values for each install. The syntax is ...&orderby=field [order],field [order],... . The field parameter can be one of the following strings:customerTenantId customerName subscriptionId subscriptionName usageDate resourceLocation meterCategory meterSubcategory meterUnit The order parameter is optional and can be asc or desc to specify ascending or descending order for each field, respectively. The default is asc .Example: ...&orderby=meterCategory,meterUnit |
groupby | string | A statement that applies data aggregation only to the specified fields. You can specify the following fields:customerTenantId customerName subscriptionId subscriptionName usageDate resourceLocation meterCategory meterSubcategory meterUnit The returned data rows will contain the fields specified in the groupby parameter and the Quantity.The groupby parameter can be used with the aggregationLevel parameter.Example: ...&groupby=meterCategory,meterUnit |
Request headers
For more information, see Partner Center REST headers.
Request body
None.
Request example
GET https://api.partnercenter.microsoft.com/partner/v1/analytics/usage/azure HTTP/1.1
Authorization: Bearer <token>
Accept: application/json
Content-Type: application/json
Content-Length: 0
REST response
If successful, the response body contains a collection of Azure usage resources.
Response success and error codes
Each response comes with an HTTP status code that indicates success or failure and additional debugging information. Use a network trace tool to read this code, error type, and additional parameters. For the full list, see Error Codes.
Response example
{
"customerTenantId": "39A1DFAC-4969-4F31-AF94-D76588189CFE",
"customerName": "A",
"subscriptionId": "aaaa0a0a-bb1b-cc2c-dd3d-eeeeee4e4e4e",
"subscriptionName": "AZURE PURCHSE SAMPLE APP",
"usageDate": "2018-05-27T00:00:00",
"resourceLocation": "useast",
"meterCategory": "Data Management",
"meterSubcategory": "None",
"meterUnit": "10,000s",
"quantity": 20
}