[{"label":"Latest (1.0.0)","version":"latest"}]
cost-and-usage-management

Get Historical Usage Records

Description

This 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

Request

URL

URL


get
https://console.cloud.vmware.com/commerce/cost-and-usage/api/{org_id}/usage/historical-records
Copy

Path Parameters

Path Parameters

string
org_id Required

Unique identifier (GUID) of the organization


Query Parameters

Query Parameters

string
aggregation_period Optional

The frequency at which the usage records should be aggregated. Default is HOURLY

Possible values are: HOURLYDAILYMONTHLY


string
aggregation_type Optional

The type of aggregation to be performed on the usage records. Default is AVERAGE

Possible values are: AVERAGEMINMAX


string
end_date Required

The end of the time range for which you want to retrieve usage records (yyyy-mm-dd)


string
locale Optional

Locale with language preference (e.g. en_US)


string
metric_id Required

Unique identifier of the metric


integer
page Optional

The index of requested page (0-based). Default = 0

Parameter Serialization Style: form Explode:true

string
resource_id Optional

Unique identifier of the resource


string
seller Optional

The name of the seller providing the usage. Default is multiple


string
service_definition_id Required

Unique identifier of the service


integer
size Optional

Size of each page. Default = 20

Parameter Serialization Style: form Explode:true

array of string
sort Optional

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”

Parameter Serialization Style: form Explode:true

string
start_date Required

Beginning of the time range for which you want to retrieve usage records (yyyy-mm-dd)


Response

Response

Response Body

Response Body

200 OK

Returns HistoricalUsageResponse of type application/json
{
	"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
}
content Optional

List of Historical Usage Record items


boolean
empty Optional

Whether there is no item to be returned


boolean
first Optional

Whether user request the first page


boolean
last Optional

Whether user request the last page


metadata Optional

The metadata for the metric


integer as int32
number Optional

Index of requested page (0-based)


integer as int32
number_of_elements Optional

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.


pageable Optional

Pagination information given by user


integer as int32
size Optional

Size of each page


sort Optional

Sort information given by user


integer as int64
total_elements Optional

Total number of results


integer as int32
total_pages Optional

Total number of pages

Errors

Errors

ApiError
400

Bad Request


401

Unauthorized


403

Forbidden

Code Samples

Code Samples

cURL Command

curl https://console.cloud.vmware.com/commerce/cost-and-usage/api/{org_id}/usage/historical-records?end_date=string&metric_id=string&service_definition_id=string&start_date=string


[{"label":"Latest (1.0.0)","version":"latest"}]
cost-and-usage-management
Feedback

Was this page helpful?