返回结果主要有XML和JSON两种格式,默认为XML,您可以指定公共请求参数Format
变更返回结果的格式。更多详情,请参见公共参数。为了便于查看和美观,API文档返回示例均有换行和缩进等处理,实际返回结果无换行和缩进处理。
正常返回示例
接口调用成功后会返回接口返回参数和请求ID,我们称这样的返回为正常返回。HTTP状态码为2xx。
- XML示例
<?xml version="1.0" encoding="UTF-8"?> <!--结果的根结点--> <ActionResponse> <RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId> <!--返回请求标签--> <Result> true </Result> <!--返回结果数据;不同接口格式不一样--> <Success> true </Success> <!-- 请求是否成功 true or false--> </ActionResponse>
- JSON示例
{ "RequestId": "4C467B38-3910-447D-87BC-AC049166F216" /* 返回结果数据 */ "Success": true, "Result": true }
异常返回示例
接口调用出错后,会返回错误码、错误信息和请求ID,我们称这样的返回为异常返回。HTTP状态码为4xx或者5xx。
您可以根据接口错误码排查错误。
XML
示例<?xml version="1.0" encoding="UTF-8"?><!--结果的根结点--> <Error> <RequestId>540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx</RequestId> <!--请求 ID--> <HostId>quickbi-public-share.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
示例{ "RequestId": "540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx", /* 请求 ID */ "HostId": "quickbi-public-share.aliyuncs.com", /* 服务节点 */ "Code": "MissingParameter.CommandId", /* 错误码 */ "Message": "The input parameter “CommandId” that is mandatory for processing this request is not supplied." /* 错误信息 */ }