Help & DocumentationDirect Connect

Async Task API Response

Last updated: 2018-06-25 14:50:47

1. Format of Returned Results for Ordinary Asynchronous Task APIs

With such asynchronous task APIs, only one resource can be operated for each request, for example, creating load balancer or resetting OS for server.

Name Type Description Required
code Int Error code on the result. 0: Successful; other values: Failed. Yes
message String Error message on the result No
requestId String Task ID Yes

2. Format of Returned Results for Batch Asynchronous Task APIs

With such asynchronous task APIs, multiple resources can be operated for each request, for example, changing passwords, starting or shutting down servers.

Name Type Description Required
code Int Error code on the result. 0: Successful; other values: Failed. Yes
message String Error message on the result No
detail Array The code, message, and requestId for an operation performed on the resource based on the resource ID (key). Yes

For example:

{
        "code":0,
        "message": "success",
        "detail":
        {
             "qcvm6a456b0d8f01d4b2b1f5073d3fb8ccc0":
            {
             "code":0,
             "message":"",
             "requestId":"1231231231231":,
            }
              "qcvm6a456b0d8f01d4b2b1f5073d3fb8ccc0":
            {
              "code":0,
              "message":"",
              "requestId":"1231231231232":,
            }
        }
}

Note:
If the operations are successful for all resources, the outermost code is 0.
If the operations fail for all resources, the outermost code returns 5100.
If the operations fail for some resources, the outermost code returns 5400.
In the third case, the terminal can obtain the information about the failed operations via "detail" field.