Returned Format for Async Task APIs

Last updated: 2017-04-20 15:21:21

    1. Format of Returned Results for Common Asynchronous Task APIs

    You can only operate asynchronous task APIs for one resource in each request, for example, creating load balance or resetting host operating system, and so on.

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

    2. Format of Returned Results for Batch Asynchronous Task APIs

    You can operate asynchronous task APIs for multiple resources in each request, for example, changing passwords, starting machines, stopping machines, and so on.

    Name Type Description Required
    code Int Error code of the returned result. 0: Succeed; other values: Failed. Yes
    message String Error message of the returned result No
    detail Array The code, message, and requestId of the operation performed on the resource ("key" is resource ID) Yes

    For example:

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

    Note:
    If all operations performed on the resource succeed, the outermost code will be 0
    If all operations performed on the resource fail, the outermost code will be 5100
    If part of operations performed on the resource fail, the outermost error code will be 5400
    In the third case, the terminal can obtain the information about failed operations by using the detail field.

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help