Return Code Format of Async Task API

Last updated: 2018-06-01 16:19:12

1. Return format for ordinary asynchronous task APIs

For such asynchronous task APIs, one request operates only one resource, for example creating load balance, resetting the host operating system.

Name Type Description Required
code Int Error code, 0 for succeeded, other values for failed. Yes
message String Error message returned No
requestId String Task No. Yes

2. Return Format of Batch Asynchronous Task APIs

For such asynchronous task APIs, one request operates multiple resources, for example changing passwords, starting machines, stopping machines.

Name Type Description Required
code Int Error code, 0 for succeeded, other values for failed. Yes
message String Error message returned No
detail Array The resource ID is used as the key and the code, message, requestId for the resource operation is returned. Yes

For example:

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

Note:
If all resource operations succeeded, the outermost code is 0
If all resource operations failed, the outermost code will be 5100
If some resource operations failed, the outermost code will be 5400
In the third case, the terminal can get information about the failed operations via details.