错误返回
更新时间:2024-12-05
当用户访问API出现错误时,会返回给用户相应的错误码和错误信息,便于定位问题,并做出适当的处理;请求发生错误时通过Response Body返回详细错误信息,遵循如下格式:
参数名 | 类型 | 说明 |
---|---|---|
requestId | String | 导致该错误的requestId |
code | String | 字符串,用于表示具体错误类型 |
message | String | 有关该错误的详细说明 |
示例:
{
"requestId": "7a64abd6-5fd8-4f42-a795-bb51c8cf5c6a",
"code": "MediaException.MediaNotFound",
"message": "Media not found with mda-jdekywp8pek91e0n"
}
公共错误码
下表列出了百度智能云API的公共错误码。
错误码 | 错误消息 | HTTP状态码 | 描述 |
---|---|---|---|
AccessDenied | Access denied. | 403 Forbidden | 无权限访问对应的资源。 |
InappropriateJSON | The JSON you provided was well-formed and valid, but not appropriate for this 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 does not exist in our records. | 403 Forbidden | Access Key ID不存在。 |
InvalidHTTPAuthHeader | The Access Key ID you provided does not exist in our records. | 400 Bad Request | 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 Bad Request | JSON格式不合法。 |
InvalidVersion | The API version specified was invalid. | 404 Not Found | URI的版本号不合法。 |
OptInRequired | A subscription for the service is required. | 403 Forbidden | 没有开通对应的服务。 |
PreconditionFailed | The specified If-Match header doesn’t match the ETag header. | 412 Precondition Failed | 详见Etag。 |
RequestExpired | Request has expired. Timestamp date is . | 400 Bad Request | 请求超时。要改成x-bce-date。若请求中只有Date,需将Date转成datetime。 |
IdempotentParameterMismatch | The request uses the same client token as a previous, but non-identical request. | 403 Forbidden | clientToken对应的API参数不一样。 |
SignatureDoesNotMatch | The request signature we calculated does not match the signature you provided. Check your Secret Access Key and signing method. Consult the service documentation for details. | 400 Bad Request | Authorization头域中附带的签名和服务端验证不一致。 |
VOD错误返回码
下表列出了VOD API的常见错误码,更详细的错误码在具体API文档中列出。
错误码 | 错误消息 | HTTP状态码 | 描述 |
---|---|---|---|
MediaNotFound | Media not found with mda-xxx | 404 Not Found | 没有找到对应的媒资 |
IllegalMediaSessionKey | Media session key xxx is illegal | 400 Bad Request | 非法的sessionKey |
MediaSourceFileNotFound | Media source file not found with session key : xxx | 404 Not Found | 媒资文件未找到 |
MultipartEtagsMissing | multipart etags missing for media mda-xxx | 400 Bad Request | 缺少分片上传etag标识 |
MediaBanned | Media mda-xxx is banned | 403 Forbidden | 媒资被封禁 |
MediaProcessParamError | Media mda-xxx process param error, xxx | 400 Bad Request | 媒资处理参数错误 |
MediaTaskNotFound | MediaTask tsk-xxx not found | 404 Not Found | 没有找到对应的媒资任务 |
UserNotFound | User with accountId xxx not found | 404 Not Found | 该账号未开通VOD服务 |
AccountOverdue | Your request is denied because there is an overdue bill of your account. | 403 Forbidden | 账号已欠费 |
AccountBanned | Your account contains sensitive information. We have restricted your resources. | 403 Forbidden | 该账号存在敏感内容,已被封禁 |
RequestConflict | Your concurrent request is conflict, please retry later | 409 Conflict | 您的请求发生冲突,请稍后重试 |
InvalidRequest | [InvalidParameter] The value you provided is not available, xxxx | 400 Bad Request | 请求的输入参数不合法 |