Return Format for Async Task APIs

Last updated: 2019-09-23 11:47:57

PDF

This is a legacy API and may be deprecated in the future. It is currently not displayed on the left sidebar. We recommend using [CVM API v3.0], which is more standardized and has much lower access latency (https://intl.cloud.tencent.com/document/api/213/15689).

The definitions of async task APIs are not provided in the documentation of new APIs (available for certain services only, such as CVM). For specific usage, see the Action field in each document.

Format of Returned Results for Common Asynchronous Task APIs

Sending one request to common asynchronous task APIs allows you to operate only one type of resource at a time. For example, you can create load balancer or reset the server’s operating system by making a call to the specified common asynchronous task API.

Name Type Description Required
code Int Error code of the returned result. 0: success; other values: failure. Yes
message String Error message of the returned result. No
requestId String Task number Yes

Format of Returned Results for Batch Asynchronous Task APIs

With such asynchronous task APIs, multiple resources can be operated for each request. For example, you can change passwords, start or shut down servers.

Name Type Description Required
code Int Error code of the returned result. 0: success; other values: failure. Yes
message String Error message of the returned result. No
detail Array The code, message, and requestID of the resource operation are returned with the resource ID as the key. Yes

For example:

{
    "code": 0,
    "message": "success",
    "detail": {
        "qcvm6a456b0d8f01d4b2b1f5073d3fb8ccc0": {
            "code": 0,
            "message": "",
            "requestId": "1231231231231"
        },
        "qcvm6a456b0d8f01d4b2b1f5073d3fb8ccc1": {
            "code": 0,
            "message": "",
            "requestId": "1231231231232"
        }
    }
}
  • If the operation succeeds for all resources, the outermost code is 0.
  • If the operation fails for all resources, the outermost code is 5100.
  • If the operation fails for some resources, the outermost code is 5400. In this case, the terminal can obtain information about the failed operations via the detail field.