This article introduces how to handle the returned results after the interface call, and focuses on the specific steps. The content of this article is very compact, and I hope you will study patiently.
Return results
The returned results are mainly in two formats: XML and JSON. The default is XML. You can specify the public request parameter Format to change the format of the returned results. See Public Parameters for more details. For ease of viewing and aesthetics, the API document return examples are all processed with line breaks and indentation, but the actual return results are not processed with line breaks and indentation.
Normal return example
After the interface is called successfully, the interface return parameters and request ID will be returned. We call such a return a normal return. The HTTP status code is 2xx.
XML example
<?xml version="1.0" encoding="UTF-8"?> <!--结果的根结点--> <ActionResponse> <!--返回请求标签--> <RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId> <!--返回结果数据--> </ActionResponse>
JSON example
{ "RequestId": "4C467B38-3910-447D-87BC-AC049166F216" /* 返回结果数据 */ }
Exception return example
After an error occurs in the interface call, the error code, error message and request ID will be returned. We call such return an exception return. HTTP status codes are 4xx or 5xx.
You can troubleshoot errors based on interface error codes, public error codes, and API Error Center. When you cannot troubleshoot the error, you can submit a work order to contact us, and indicate the service node HostId and RequestId in the work order.
XML Example
<?xml version="1.0" encoding="UTF-8"?><!--结果的根结点--> <Error> <RequestId>540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx</RequestId> <!--请求 ID--> <HostId>ecs.aliyuncs.com</HostId> <!--服务节点--> <Code>MissingParameter.CommandId</Code> <!--错误码--> <Message>The input parameter “CommandId” that is mandatory for processing this request is not supplied.</Message> <!--错误信息--> </Error>
JSON Example
{ "RequestId": "540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx", /* 请求 ID */ "HostId": "ecs.aliyuncs.com", /* 服务节点 */ "Code": "MissingParameter.CommandId", /* 错误码 */ "Message": "The input parameter “CommandId” that is mandatory for processing this request is not supplied." /* 错误信息 */ }
Public Error Code
##
The above is the detailed content of How to handle the returned results after calling the interface. For more information, please follow other related articles on the PHP Chinese website!