You can call this operation to push metering data.

  • Currently, you cannot call this operation as a RAM user.
  • All request parameters of this operation must be URL-encoded.
  • Alibaba Cloud Marketplace allows you to send only one request to push metering data of each instance within 60 seconds. Each request can contain a maximum of 100 metering data records.

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 PushMeteringData

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

Metering String No [{"InstanceId":"1000001","StartTime":"100000000","EndTime":"100000010","Entities":[{"Key":"Frequency","Value":"96"}]}]

The parameters in the example are described as follows:

  • InstanceId: the ID of an instance on Alibaba Cloud Marketplace.
  • StartTime: the time when the metering operation started. The value is a UNIX timestamp. Unit: seconds
  • EndTime: the time when the metering operation ended. The value is a UNIX timestamp. Unit: seconds
  • Entities: the metering entity.
  • Key: the name of the metering item.
    • Frequency: the number of times the instance was used.
    • Period: the usage duration of the instance. Unit: seconds
    • Storage: the used storage space. Unit: bytes
    • NetworkOut: the upstream traffic of the instance. Unit: bit/s
    • NetworkIn: the downstream traffic of the instance. Unit: bit/s
    • Character: the number of characters.
    • DailyActiveUser: the daily number of active users.
    • PeriodMin: the usage duration of the instance. Unit: minutes
  • Value: the value of the metering item. Valid values: 0 and positive numbers

Note:

  • If bills are generated for the product in real time, the difference between the values of the StartTime and EndTime parameters is not limited. However, the time specified by the EndTime parameter must be later than that specified by the StartTime parameter.
  • If bills are generated for the product by billing cycle, for example, by hour, by day, or by month, the difference between the values of the StartTime and EndTime parameters must be greater than 5 minutes.
  • In a request for pushing multiple metering data records, the values of InstanceId must indicate instances of the same product. Currently, the PushMeteringData operation does not support pushing metering data of instances of multiple products at the same time.

Response parameters

Parameter Type Example Description
RequestId String 6EF60BEC-0242-43AF-BB20-270359FB54A7

The ID of the request.

Success Boolean true

Indicates whether the call of the operation was successful.

Examples

Sample requests

http(s)://market.aliyuncs.com/? Action=PushMeteringData
&Metering=%5B%7B%22InstanceId%22%3A%221000001%22%2C%22StartTime%22%3A%22100000000%22%2C%22EndTime%22%3A%22100000010%22%2C%22Entities%22%3A%5B%7B%22Key%22%3A%22Frequency%22%2C%22Value%22%3A%2296%22%7D%5D%7D%5D
&<Common request parameters>

Sample success responses

XML format

<PushMeteringDataResponse>
  <RequestId>6EF60BEC-0242-43AF-BB20-270359FB54A7</RequestId>
  <Success>true</Success>
</PushMeteringDataResponse>

JSON format

{
    "RequestId": "6EF60BEC-0242-43AF-BB20-270359FB54A7",
    "Success": "true"
}

Error codes

HTTP status code Error code Error message Description
500 UnknownError An error occurred while processing your request. The error message returned because an unknown error has occurred.
500 Service.Flow.Control The rate throttling threshold has been exceeded. The error message returned because the number of requests exceeds the upper limit.
500 Invalid.Parameter The specified parameter is invalid. The error message returned because the specified request parameters are invalid.
500 Invalid.Parameter.Instance The specified Instance parameter is invalid. The error message returned because the specified Instance parameter is invalid.
500 Invalid.Parameter.Metering The specified Metering parameter is invalid. The error message returned because the specified Metering parameter is invalid.
500 Metering.Data.Exceeded The number of metering entities must not exceed 100. The error message returned because the number of metering entities cannot exceed 100.
500 Permission.Denied You are not authorized to call the API operation. Contact the API developer to add your account to the API user whitelist. The error message returned because you are not authorized to call the API operation. Contact the API developer to add your account to the API user whitelist.

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