Queries the usage details of reserved instances (RIs) or storage capacity units (SCUs).

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeResourceUsageDetail

The operation that you want to perform. Set the value to DescribeResourceUsageDetail.

PeriodType String Yes HOUR

The time granularity at which usage details are queried. Valid values: MONTH, DAY, and HOUR.

ResourceType String Yes RI

The type of deduction plans whose usage details are queried. Valid values: RI and SCU.

StartPeriod String Yes 2021-01-01 00:00:00

The beginning of the time range to query. The beginning is included in the time range. Specify the time in the format of yyyy-MM-dd HH:mm:ss.

EndPeriod String No 2021-01-02 00:00:00

The end of the time range to query. The end is excluded from the time range. If you do not set this parameter, the end time is the current time. Specify the time in the format of yyyy-MM-dd HH:mm:ss.

NextToken String No eyJwYWdlTnVtIjoyLCJwYWdlU2l6ZSI6MTB9

The token that is used to retrieve the next page of results. You do not need to set this parameter if you query usage details within a specific time range for the first time. The response returns a token that you can use to query usage details that are displayed on the next page. If a null value is returned for the NextToken parameter, no more usage details can be queried.

MaxResults Integer No 200

The maximum number of entries to return. Default value: 20. Maximum value: 300.

Response parameters

Parameter Type Example Description
Code String Success

The status code.

Data Struct

The returned data.

Items Array of Item

The data entries.

CapacityUnit String Calc*Hour

The unit that is used to measure the resources deducted from deduction plans.

Currency String CNY

The currency in which deduction plans were priced.

DeductQuantity Float 1

The amount of the resources deducted from deduction plans.

EndTime String 2021-04-01 01:00:00

The end of the time range in which the usage details were queried.

ImageType String linux

The operating system.

InstanceSpec String ecs.t5-lc2m1.nano

The specifications of a deduction plan.

PostpaidCost String 0.06

The equivalent of pay-as-you-go costs.

PotentialSavedCost String 0.13

The potential net savings.

Quantity Long 2

The number of deduction plans.

Region String China (hangzhou)

The region.

RegionNo String cn-hangzhou-dg-a01

The code of the region.

ReservationCost String 0

The fee of purchased deduction plans.

ResourceInstanceId String ecsri-bp147nnfz21225k9mpix00

The ID of a deduction plan.

SavedCost String 0.06

The net savings.

StartTime String 2021-04-01 00:00:00

The beginning of the time range in which the usage details were queried.

Status String Valid

The status of the deduction plan.

StatusName String Active

The name of the state.

TotalQuantity Float 2

The total capacity of deduction plans.

UsagePercentage Float 0.5

The usage of deduction plans.

UserId String 123745698925000

The ID of the account.

UserName String test@aliyun.com

The username of the account.

Zone String cn-hangzhou-i

The code of the zone.

ZoneName String Hangzhou Zone I

The zone.

MaxResults Integer 200

The number of entries returned on the current page.

NextToken String eyJwYWdlTnVtIjoyLCJwYWdlU2l6ZSI6MTB9

The token of the next page.

TotalCount Integer 10000

The total number of entries returned.

Message String Successful!

The message returned.

RequestId String 79EE7556-0CFD-44EB-9CD6-B3B526E3A85F

The ID of the request.

Success Boolean true

Indicates whether the operation was successful.

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeResourceUsageDetail
&PeriodType=HOUR
&ResourceType=RI
&StartPeriod=2021-01-01 00:00:00
&<Common request parameters>

Sample success responses

JSON format

{"Message":"Successful!","RequestId":"79EE7556-0CFD-44EB-9CD6-B3B526E3A85F","Data":{"TotalCount":"10000","NextToken":"eyJwYWdlTnVtIjoyLCJwYWdlU2l6ZSI6MTB9","MaxResults":"200","Items":[{"Status":"Valid","RegionNo":"cn-hangzhou-dg-a01","PostpaidCost":"0.06","InstanceSpec":"ecs.t5-lc2m1.nano","UserName":"test@aliyun.com","EndTime":"2021-04-01 01:00:00","CapacityUnit":"Calc*Hour","Zone":"cn-hangzhou-i","SavedCost":"0.06","StartTime":"2021-04-01 00:00:00","Quantity":"2","StatusName":"Active","UsagePercentage":"0.5","ImageType":"linux","ReservationCost":"0","ZoneName":"Hangzhou Zone I","TotalQuantity":"2","UserId":"123745698925000","Currency":"CNY","PotentialSavedCost":"0.13","Region":"China (hangzhou)","DeductQuantity":"1","ResourceInstanceId":"ecsri-bp147nnfz21225k9mpix00"}]},"Code":"Success","Success":"true"}

Error codes

For a list of error codes, visit the API Error Center.