返回结果主要有 XML 和 JSON 两种格式,默认为 JSON,您可以指定公共请求参数 Format 返回结果的格式。更多详情,请参阅
公共参数。
说明:为了便于查看和美观,API 文档返回示例均有换行和缩进等处理,实际返回结果无换行和缩进处理。
[font=PingFangSC, "]
[font=PingFangSC, "]正常返回示例
接口调用成功后会返回接口返回参数和请求 ID,我们称这样的返回为正常返回。HTTP 状态码为 2xx。
XML 示例
<?xml version="1.0" encoding="UTF-8"?> <!--结果的根结点-->
<ActionResponse> <!--返回请求标签-->
<RequestId>4C467B38-3910-447D-87BC-AC049166F223</RequestId> <!--返回结果数据-->
</ActionResponse>JSON 示例
{
"RequestId": "4C467B38-3910-447D-87BC-AC049166F223" /* 返回结果数据 */
}
异常返回示例
接口调用出错后,会返回错误码、错误信息和请求 ID,我们称这样的返回为异常返回。HTTP 状态码为 4xx 或者 5xx。
您可以根据接口错误码以及 公共错误码 排查错误。当您无法排查错误时,可以 提交工单 联系我们,并在工单中注明服务节点 HostId 和 RequestId。
XML 示例
<?xml version="1.0" encoding="UTF-8"?><!--结果的根结点-->
<Error>
<RequestId>540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx</RequestId> <!--请求 ID-->
<HostId>ess.aliyuncs.com</HostId> <!--服务节点-->
<Code>InternalError</Code> <!--错误码-->
<Message>The request processing has failed due to some unknown error, exception or failure.</Message> <!--错误信息-->
</Error>
JSON 示例
{
"RequestId": "540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx", /* 请求 ID */
"HostId": "ess.aliyuncs.com", /* 服务节点 */
"Code": "InternalError", /* 错误码 */
"Message": "The request processing has failed due to some unknown error, exception or failure." /* 错误信息 */
}
公共错误码
错误代码 | 错误信息 | HTTP 状态码 | 说明 |
InvalidAccessKeyId.NotFound | The Access Key ID provided does not exist in our records. | 400 | 指定的 AccessKey 不存在。 |
InvalidParameter | The specified value of parameter <parameter name> is not valid. | 400 | 指定的参数取值不合法。 |
MissingParameter | The input parameter <parameter name> that is mandatory for processing this request is not supplied | 400 | 缺少必需参数。 |
NoSuchVersion | The specified version does not exist. | 400 | 指定的 API 版本不存在。 |
ResourceNotAvailable | Resource you requested is not available in this region or zone. | 400 | 指定的地域暂未部署弹性伸缩服务。 |
Throttling | Request was denied due to request throttling. | 400 | 系统流控期间,请稍后再试。 |
UnsupportedOperation | The specified action is not supported. | 400 | 无法调用指定的 API。 |
Forbidden | Users are not authorized to operate on the specified resource. | 403 | 您无法执行该操作。 |
Forbidden.RiskControl | This operation is forbidden by Aliyun Risk Control system. | 403 | 系统风险控制,禁止该操作。 |
Forbidden.Unsubscribed | Do not have permission to access this API. | 403 | 您未开通弹性伸缩服务,无法调用该 API。 |
Forbidden.UserVerification | Your user account is not verified by Aliyun. | 403 | 您未完成实名认证。更多详情,请参阅 账号实名认证相关文档。 |
SignatureDoesNotMatch | The signature we calculated does not match the one you provided. | 403 | 我们计算得出的签名与您提供的签名不匹配。 |
InternalError | The request processing has failed due to some unknown error, exception or failure. | 500 | 系统错误。 |
ServiceUnavailable | The request has failed due to a temporary failure of the server. | 503 | 服务器当前无法处理请求,请稍后再试。 |
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。
返回结果支持两种主要格式:XML 和 JSON,默认采用 JSON 格式。您可以通过设置公共请求参数 Format
来指定响应的格式。
正常返回示例中,当接口调用成功后,HTTP 状态码为 2xx,会返回接口执行的具体参数及一个唯一的请求 ID,例如:
XML 示例:
<?xml version="1.0" encoding="UTF-8"?>
<ActionResponse>
<RequestId>4C467B38-3910-447D-87BC-AC049166F223</RequestId>
</ActionResponse>
JSON 示例:
{
"RequestId": "4C467B38-3910-447D-87BC-AC049166F223"
}
异常返回示例中,如果接口调用出错,HTTP 状态码将为 4xx 或 5xx,并包含错误码、错误信息和请求 ID,例如:
XML 异常示例:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<RequestId>540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx</RequestId>
<HostId>ess.aliyuncs.com</HostId>
<Code>InternalError</Code>
<Message>The request processing has failed due to some unknown error, exception or failure.</Message>
</Error>
JSON 异常示例:
{
"RequestId": "540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx",
"HostId": "ess.aliyuncs.com",
"Code": "InternalError",
"Message": "The request processing has failed due to some unknown error, exception or failure."
}
针对不同的错误情况,系统定义了一系列公共错误码,如 InvalidAccessKeyId.NotFound
表示 AccessKey 不存在(HTTP 400),Forbidden
表示无权限执行操作(HTTP 403),以及 InternalError
表示系统内部错误(HTTP 500)等。这些错误码有助于定位问题原因并进行相应处理。
在遇到问题时,首先根据返回的错误码对照公共错误码文档进行排查。若无法自行解决,可提交工单并提供 HostId 和 RequestId 以便获取进一步帮助。
请注意,API 文档中的示例为了便于阅读进行了格式化,实际返回数据不会包含换行和缩进。
参考资料: 返回结果与格式设置说明
正常与异常返回示例
公共错误码列表