Handle returned results

Last Updated: Jul 03, 2017

After the API service is called, data is returned in a unified format. The returned HTTP status code 2xx indicates that the call is successful. The returned HTTP status code 4xx or 5xx indicates that the call fails. For successful calls, the returned data are mainly in two formats: XML and JSON. When a request is sent, an external system can input a parameter to define the format of returned data, which is XML by default. In this document, examples of returned results are formatted in a way that is easier for you to view. The actual results returned are not formatted with line breaks, indentation, and so on.

Successful results

XML example

XML returned results include a message stating if the request is successful and the specific service data. Example:

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <!—Result root node-->
  3. <Interface name+response>
  4. <!—Return request tag-->
  5. <RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId>
  6. <!—Return result data-->
  7. </Interface name+response>

JSON example

  1. {
  2. "RequestId": "4C467B38-3910-447D-87BC-AC049166F216",
  3. /* Return result data*/
  4. }

Error results

  When an error occurs in an interface call, no results will be returned. You can query the attached appendix <Error code table> to locate error causes.

  When an error occurs in an invocation, an HTTP status code 4xx or 5xx will be returned for an HTTP request. The returned message body contains the specific error code and error message. The message body also contains the globally unique “RequestId” and the requested “HostId”. If you cannot find the error cause, you can contact Alibaba Cloud customer service and provide “HostId” and “RequestId” to help us solve the problem as quickly as possible.

XML example

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <Error>
  3. <RequestId>8906582E-6722-409A-A6C4-0E7863B733A5</RequestId>
  4. <HostId>ram.aliyuncs.com</HostId>
  5. <Code>InvalidParameter</Code>
  6. <Message>The specified parameter "Action or Version" is not valid.</Message>
  7. </Error>

JSON example

  1. {
  2. "RequestId": "7463B73D-35CC-4D19-A010-6B8D65D242EF",
  3. "HostId": "ram.aliyuncs.com",
  4. "Code": "InvalidParameter",
  5. "Message": "The specified parameter \"Action or Version\" is not valid."
  6. }
Thank you! We've received your feedback.