接口规范
更新时间:2021-03-31
请求头域内容(HTTP Request Header)
音视频转码的API服务需要在请求的HTTP头域中包含以下信息:
- host(必选)
- x-bce-date (必选)
- x-bce-request-id(可选)
- authorization(必选)
- content-type(可选)
- content-length(可选)
作为示例,以下是一个标准的用户获取队列清单时的请求头域内容:
GET /v3/pipeline/high_priority_pipe HTTP/1.1
accept-encoding: gzip, deflate
x-bce-date: 2015-03-24T13:04:26Z
host: media.bj.baidubce.com
accept: */*
connection: keep-alive
x-bce-request-id: 47281222-f0ff-4f80-9a4d-0140ff77dcd0
content-type: application/json
authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2015-03-24T13:04:26Z/1800/host;x-bce-date/b1ad7075b37616b846a356d1db86e73abba1aed51b4d7b0d95321f69f17250b1
请求消息体格式(HTTP Request Body)
音视频转码的API服务要求使用JSON格式的结构体来描述一个请求的具体内容。 作为示例,以下是一个标准的用户创建任务时的请求消息体格式:
{
"targetKey": "output_example.flv",
"sourceKey": "input_example.mp4",
"presetName": "bce.video_mp4_1920x1080_3660kbps"
}
请求返回格式(HTTP Response)
音视频转码的API服务均采用JSON格式的消息体作为响应返回的格式。 作为示例,以下是一个标准的用户查询队列时的完整的请求返回:
HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 47281222-f0ff-4f80-9a4d-0140ff77dcd0
Cache-Control: no-cache
Server: BWS
Date: Tue, 24 Mar 2015 13:04:27 GMT
Content-Type: application/json;charset=UTF-8
{
"pipelineName": "high_priority_pipe",
"sourceBucket": "examplesourceBucket",
"targetBucket": "exampletargetBucket",
"pipelineSize": 5,
"state":"ACTIVE",
"lastUpdateTime": "15-03-24T13:02:00Z",
"description": "Example Pipeline for Demo Purpose.",
"jobStatus":{
"total": 0,
"running": 0,
"pending": 0,
"success": 0,
"failed": 0
}
}
错误信息格式
HTTP状态码 | 错误码 | 错误信息 | 描述 |
---|---|---|---|
404 | NoSuchPreset | The requested preset does not exist. Please double confirm your preserId or the existence of the preset. | 所访问的Preset不存在,请重新确定指定的presetName是否正确或确认指定Preset是否存在。 |
404 | NoSuchPipeline | The requested pipeline does not exist. Please confirm your pipelineName or the existence of the pipeline. | 所访问的Pipeline不存在,请重新确定指定的pipelineName是否正确或确认指定Pipeline是否存在。 |
404 | NoSuchJob | The requested job does not exist. Please confirm your jobId or the existence of the job. | 所访问的Job不存在,请重新确定指定的jobId是否正确或确认指定Job是否存在。 |
400 | PipelineFull | The requested pipeline is full. Please wait for the pipeline to fullfill more jobs or have a new one. | 任务队列已满,请等待队列中的任务完成或者创建一个新的队列。 |
400 | InvalidBucket | You have no access to bucket: {bucket name}. Please confirm your bucket name or the existence of the bucket. | 用户指定的Bucket无法访问,请确认Bucket的拼写或确认Bucket是否存在。 |
400 | PipelineNotEmpty | Pipeline have jobs in pending or running status. Please wait for the jobs to be completed and try again. | 队列中尚包含等待或运行中的任务,无法继续下一步操作,请等待队列中的任务完成。 |
404 | PipelineNotActive | Pipeline has been deleted. Please confirm your pipelineName or specify another pipeline. | 队列已被标记删除,请重新确认pipelineName或者指定其他的Pipeline. |
400 | PresetNotEmpty | Preset has jobs applied in pending or running status. Please wait for the jobs to be completed and try again. | 使用该模板任务尚有处在在等待或运行中的状态,请等待使用该模板的任务全部完成。 |
400 | InvalidParameterException | There are field(s) invalied in the request messsage body, please check. | 请求的结构体中包含一个或者多个字段错误,请检查确认。 |
400 | InvalidDelogo | Delogo (去水印) is not supported if preset is transmux | transmux模式下不可设置去水印 |