Retrieve Resource Usage Costs
Retrieves a history of usage costs and related details for all of your past and present resources. This information includes the details of the resource, the billing costs per minute, the total cost for the resource, and other relevant information.
HTTP Request
GET {API_URL}billing/resources/usage
Query string parameters
| Parameters | Requirements | Type | Description |
|---|---|---|---|
limit | Optional | int | The number of items to return |
offset | Optional | int | The number of items to skip before starting to collect the result set |
sortField | Optional | string | The field by which the data will be ordered |
sortOrder | Optional | string | Sorting order: desc、asc |
filters | Optional | string | Stringified array of filter objects. eg: [{"key":"name","op":"contains","val":"hub"}] |
Reponse Attributes
status boolean
Indicates the result of the request to create virtual machine. true signifies success, while false indicates an error.
message string
A description of the status of the request.
total int
Total records count
data object
An array of objects containing information about the usage costs history for each resource.
Child attributes
resourceThe info for the resource.idThe ID for the resource.nameThe name for the resource.display_nameThe display name for the resource.typeThe type of resource,vmfor virtual machine, orvolumefor storage volumes.
per_minute_feeThe current billing rate per minute for the resource.total_uptimeThe total uptime of the resource in minutes.total_feeThe total cost incurred by the resource.terminated_timeThe timestamp when the resource was terminated.created_timeThe timestamp when the resource was created.statusIndicates whether the resource is currently active.terminatedindicates that the resource is not active, whileactiveindicates that it is.
Example
Request
curl -X GET '{API_URL}billing/resources/usage' \
-H 'Authorization: Bearer {ACCESS_TOKEN}' \
-H 'refresh-token: {REFRESH_TOKEN}' \
-H 'Content-Type: application/json'Response
{
"status": true,
"message": "Getting resources usage successful",
"data": [
{
"id": "66d0941d2b2a500012c73314",
"resource": {
"id": "66d093df2b2a500012c732e8",
"name": "medical-breakable-pipe",
"display_name": "TestxA4000",
"type": "vm"
},
"created_time": 1724945437,
"status": "terminated",
"terminated_time": 1724982385,
"total_uptime": 616,
"total_fee": 3.148992,
"per_minute_fee": 0.005112
}
],
"total": 1
}
