Get Historical Usage Records
DescriptionThis API lets you get a sortable and paginated list of historical usage records for a specific time period, service identifier, and metric identifier within your organization. You need to specify a valid start and end date for your time range, with the start date always before the end date. The API has different limitations on the time range based on the aggregation period you select. For example, if you choose HOURLY aggregation, you can set a time range up to 30 days from the current date. If you prefer DAILY or MONTHLY aggregation, the time range must fall within the past 2 years from the current date.
Request
URLURL
Path Parameters
Path Parameters
Unique identifier (GUID) of the organization
Query Parameters
Query Parameters
The frequency at which the usage records should be aggregated. Default is HOURLY
Possible values are: HOURLY , DAILY , MONTHLY
The type of aggregation to be performed on the usage records. Default is AVERAGE
Possible values are: AVERAGE , MIN , MAX
The end of the time range for which you want to retrieve usage records (yyyy-mm-dd)
Locale with language preference (e.g. en_US)
Unique identifier of the metric
The index of requested page (0-based). Default = 0
Unique identifier of the resource
The name of the seller providing the usage. Default is multiple
Unique identifier of the service
Size of each page. Default = 20
Sorting criteria for the paginated request in the format: “property(,asc|desc)”. For multiple sort criteria: “sort=property1(,asc|desc)&sort=property2(,asc|desc)”. Supported sorting properties are “usage_date_time, commit_quantity, usage_quantity, (overage_quantity for hourly usage)”. Default is “usage_date_time,desc”
Beginning of the time range for which you want to retrieve usage records (yyyy-mm-dd)
Response
Response BodyResponse Body
200 OK
{
"content": [
{
"commitment": 0,
"overage": 0,
"resources": [
{
"resource_id": "string",
"usage_quantity": 0
}
],
"usage": 0,
"usage_datetime": "string"
}
],
"empty": false,
"first": false,
"last": false,
"metadata": {
"charge_attributes": {
"key": "string"
},
"display_name": "string",
"metric_id": "string",
"service_definition_id": "string",
"unit_of_measure_display_name": "string"
},
"number": 0,
"number_of_elements": 0,
"pageable": {
"offset": 0,
"page_number": 0,
"page_size": 0,
"paged": false,
"sort": {
"empty": false,
"sorted": false,
"unsorted": false
},
"unpaged": false
},
"size": 0,
"sort": {
"empty": false,
"sorted": false,
"unsorted": false
},
"total_elements": 0,
"total_pages": 0
}
Whether there is no item to be returned
Whether user request the first page
Whether user request the last page
Index of requested page (0-based)
The number of HistoricalUsageRecord items as the result of filter/sort/pagination operations. If there are no such operations, it will be equal to total_elements.
Size of each page
Total number of results
Total number of pages
Errors
Bad Request
Unauthorized
Forbidden