响应状态码
响应 HTTP 状态码成功请求的情况下均为 200。失败请求会返回 4xx 及 5xx 的错误码。同时,响应是否正常,还需通过响应结果中的 ResponseMetadata 结构体是否存在 Error 字段来判断,存在则可判断响应失败。
响应结果示例
{ "ResponseMetadata": { "RequestId": "201806041104200100100232280022D30", "Action": "DescribeKeys", "Version": "2021-02-18", "Service": "kms", "Region": "cn-north-1" }, "Result": { ...... } }
{ "ResponseMetadata": { "RequestId": "2021080519374301022514515201DBC0DD", "Action": "UpdateKeyring", "Version": "2021-02-18", "Service": "kms", "Region": "cn-north-1", "Error": { "Code": "Not Found", "Message": "Not found keyring [demo_keyring11111]." } } }