公共头和错误返回
更新时间:2022-04-25
公共头规格
公共请求头
公共头部 | 描述 |
---|---|
Authorization | 包含Access Key与请求签名。 |
Content-Type | application/json; charset=utf-8。 |
x-bce-date | 表示日期的字符串,符合API规范。 |
HTTP协议的标准头域不再这里列出。公共头域将在每个CFW API中出现,是必需的头域。POST、PUT、DELETE等请求数据放在request body中。
公共响应头
公共头部 | 描述 |
---|---|
Content-Type | application/json; charset=utf-8。 |
x-bce-request-id | CFW后端生成,并自动设置到响应头域中。 |
错误返回
当用户访问CFW出现错误时,CFW会返回给用户相应的错误码和错误信息,便于用户定位问题,并做出适当的处理。请求发生错误时通过Response Body返回详细错误信息,遵循如下格式:
参数名 | 类型 | 说明 |
---|---|---|
code | String | 错误码 |
message | String | 错误描述 |
requestId | String | 本次请求的requestId |
示例:
{
"code": "NoSuchObject",
"message": "account not exist",
"requestId": "c4abab14-ebc4-4eb0-85d2-03c4d51eed18"
}
BCE公共错误码
错误返回码 | 错误消息 | 状态码 | 说明 |
---|---|---|---|
AccessDenied | Access denied. | 403Forbidden | 无权限访问对应的资源。 |
QualifyNotPass | The User has not pass qualify. | 403 | 账号没有通过实名认证 |
InappropriateJSON | The JSON you provided was well-formed and valid, but not appropriate forthis operation. | 400 Bad Request | 请求中的JSON格式正确,但语义上不符合要求。如缺少某个必需项,或值类型不匹配等。出于兼容性考虑,对于所有无法识别的项应直接忽略,不应该返回这个错误。 |
InternalError | We encountered an internal error Please try again. | 500 Internal Server Error | 所有未定义的其他错误。在有明确对应的其他类型的错误时(包括通用的和服务自定义的)不应该使用。 |
InvalidAccessKeyId | The Access Key ID you provided doesnot exist in our records. | 403Forbidden | Access Key ID不存在。 |
InvalidHTTPAuthHeader | The Access Key ID you provided does notexist in our records. | 400 BadRequest | Authorization头域格式错误。 |
InvalidHTTPRequest | There was an error in the body of your HTTP request. | 400 Bad Request | HTTP body格式错误。例如不符合指定的Encoding等。 |
InvalidURI | Could not parse the specified URI. | 400 Bad Request | URI形式不正确。例如一些服务定义的关键词不匹配等。对于ID不匹配的问题,应定义更加具体的错误码,如NoSuchKey。 |
MalformedJSON | The JSON you provided was not well-formed. | 400 BadRequest | JSON格式不合法。 |
InvalidVersion | The API version specified was invalid. | 404 NotFound | URI的版本号不合法。 |
OptInRequired | A subscription for the service is required. | 403Forbidden | 没有开通对应的服务。 |
PreconditionFailed | The specified If-Match header doesn’tmatch the ETag header. | 412PreconditionFailed | 详见Etag。 |
RequestExpired | Request has expired. Timestamp date is <Data>. | 400 BadRequest | 请求超时。要改成x-bce-date。若请求中只有Date,需将Date转成datetime。 |
IdempotentParameterMismatch | The request uses the same client token asa previous, but non-identical request. | 403Forbidden | clientToken对应的API参数不一样。 |
SignatureDoesNotMatch | The request signature we calculated does not match the signature you provided. Check yourSecret Access Key and signing method. Consultthe service documentation for details. | 400 Bad Request | Authorization头域中附带的签名和服务端验证不一致。 |
CFW错误返回码
错误码 | 错误描述 | HTTP状态码 | 中文解释 |
---|---|---|---|
CfwIdInValid | The cfwId is invalid. | 400 | 非法的CFW策略id |
CfwRuleIdInvalid | The cfwRuleId is invalid. | 400 | 非法的CFW规则id |
InstanceIdInvalidException | The instance id is invalid. | 400 | 非法的防护实例id |
InstanceHasBindException | The instance has already bind cfw. | 400 | 实例已经绑定过防火墙 |
RegionInvalidException | The region is invalid. | 400 | Region信息不合法 |
PortInvalidException | The cfw rule's port is invalid. | 400 | CFW规则中端口信息不合法 |
AddressInvalidException | The cfw rule's address is invalid. | 400 | CFW规则中源IP/目的IP信息不合法 |
InstanceIdInvalidException | The cfw bind's instanceId is invalid. | 400 | CFW策略绑定的实例id信息不合法 |
CorrelationInvalidException | The binding relationship between the instance and the cfw does not exist. | 400 | CFW策略与实例之间的绑定关系不存在 |
ActionInvalidException | The Action is invalid. | 400 | CFW规则中action信息不合法 |
QuotaLimitExceeded | {quotaType} exceeded the limit. | 400 | 配额:quotaType,超出限制 |
ResourceNotFindException | Resource not find. | 400 | 资源不存在 |
BadRequest | Request parameter invalid. | 400 | 请求参数不合法 |
CfwRuleRepetitionException | The rule already exist. | 400 | CFW规则重复 |
VpcTypeInvalidException | These vpcs does not support firewalls. | 400 | VPC不支持云防火墙 |
OperationDeniedException | Operation not available. | 409 | 不可操作 |
DeleteCfwRuleException | The cfw rules cannot be deleted entirely. | 400 | CFW规则不能被全部删除 |
DeleteCfwException | The cfw has instance binding. | 400 | CFW策略存在绑定关系,不能删除 |
CfwRuleEmptyException | There are no rules in cfw. | 400 | CFW中没有规则,不能绑定实例 |