通知接口
通知功能可以在音视频转码任务状态转换时主动向开发者服务器推送消息。
创建通知
请求(Request)
-
请求语法:
POST /v{version}/notification HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: {utc-date-string} host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: {bce-request-id} content-type: application/json authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数(以下均为Requestbody参数):
字段名称 | 字段类型 | 必要性 | 字段描述 | 可选值 | 默认值 |
---|---|---|---|---|---|
name | String | 必选 | 通知名称。小写字母开头,其余部分由小写字母、下划线 (_) 或数字组成,最多不超过40个字符 | - | - |
endpoint | String | 必选 | 通知消息接收地址 | - | - |
type | String | 可选 | 通知消息类型。NONE表示普通通知回调;SIGN表示鉴权模式,会在header中增加Notification-Auth-Expire、Notification-Auth-User和Notification-Auth-Token用于验证。用户接收到回调后可以使用SHA256-HEX传入自己的token以及"POST;endpoint;content;expireTime;user"生成Notification-Auth-Token,与header中的对比进行验证 | NONE,SIGN | NONE |
token | String | 可选 | 通知消息鉴权token | - | - |
-
请求示例:
POST /v3/notification HTTP/1.1 content-length: 87 accept-encoding: gzip, deflate x-bce-date: 2015-07-03T09:28:13Z connection: keep-alive accept: */* user-agent: python-requests/2.4.0 CPython/2.7.9 Darwin/14.3.0 host: media.bj.baidubce.com x-bce-request-id: 8776558c-81d9-4f97-8e2c-f977a286095d content-type: application/json authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-bce-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715 { "name": "mct_notification", "endpoint": "http://mct.notificaitonDomain.com/" }
响应(Reponse)
- 响应头域:无特殊Header参数
- 响应参数:无
-
响应示例:
HTTP/1.1 200 OK x-bce-request-id: 8776558c-81d9-4f97-8e2c-f977a286095d Date: Fri, 03 Jul 2015 09:28:13 GMT Transfer-Encoding: chunked Content-Type: application/json;charset=UTF-8 Cache-Control: no-cache
接收通知回调
- 通知消息:
字段名称 | 字段类型 | 字段描述 |
---|---|---|
messageId | String | 通知Id |
messageBody | Object | 通知消息体 |
+ jobId | String | jobid |
+ pipelineName | String | 队列名 |
+ jobStatus | String | job状态(SUCCESS, FAILED) |
+ createTime | Date | job创建时间 |
+ startTime | Date | job开始时间 |
+ endTime | Date | job结束时间 |
+ error | Object | 错误信息 |
++ code | String | 错误码 |
++ message | String | 错误信息 |
+ source | Object | 输入的原始信息 |
++ sourceKey | String | 原始文件的BOS Key |
++ clips | Array | 待合并的原始视频信息 |
+++ bucket | String | 原始文件的BOS Bucket |
+++ sourceKey | String | 原始文件的BOS Key |
+++ asMasterClip | Boolean | 是否指定该片段作为主分片 |
+++ enableLogo | Boolean | 是否允许在该片段添加水印 |
+++ enableDelogo | Boolean | 是否允许在该片段进行去水印 |
+++ enableCrop | Boolean | 是否允许在该片段添进行去黑边 |
+++ startTimeInSecond | Number | 视频片段的起始时间 |
+++ durationInSecond | Number | 视频片段的持续时间 |
+++ startTimeInMillisecond | Number | 视频片段的起始时间(单位ms,与startTimeInSecond同时设置时,优先生效) |
+++ durationInMillisecond | Number | 视频片段的持续时间(单位ms,与durationInSecond同时设置时,优先生效) |
+ target | Object | 目前信息 |
++ targetKey | String | 目标文件的BOS key |
++ presetName | String | 输出处理的模板的presetName |
+ output | Object | 输出信息 |
++ Video | Object | 视频 |
+++ durationInSeconds | Number | 视频持续时间 |
+++ sizeInKiloByte | Double | |
+++ widthInPixel | Number | 宽 |
+++ heightInPixel | Number | 高 |
+++ frameRate | Number | 帧率 |
+++ mp4MoovSize | Number | |
++ Audio | Object | 音频 |
+++ sampleRateInHz | Number | 音频采样率 |
+++ channels | Number | 声道 |
+ secretKeyUserId | String | |
+ clusterName | String | 视频源信息 |
notification | String | 通知名称 |
server | String | 发送通知的服务host |
subscriptionName | String | (兼容QNS通知) |
version | String | (兼容QNS通知) |
signature | String | (兼容QNS通知) |
-
示例:
{ "messageBody": { "jobId": "job-jmkmdp90t4rvkhp0", "pipelineName": "test_notification", "jobStatus": "SUCCESS", "createTime": "2019-12-11T03:09:35Z", "startTime": "2019-12-11T03:09:58Z", "endTime": "2019-12-11T03:10:15Z", "source": { "clips": [ { "bucket": "tescae", "sourceKey": "input/chengdu.mp4" } ] }, "target": { "targetKey": "test_notification.mp4", "presetName": "bce.video_mp4_1920x1080_3660kbps" }, "output": { "video": { "durationInSeconds": 15, "sizeInKiloByte": 5804.772461, "widthInPixel": 606, "heightInPixel": 1080, "frameRate": 30, "mp4MoovSize": 9728 }, "audio": { "sampleRateInHz": 44100, "channels": 2 }, "bitRateInKBps": "3095.88" } }, "messageId": "943520a5-14c4-4980-84a0-9c44b8dfe517", "notification": "test_to_dev_8009", "server": "multimedia.bce-testinternal.baidu.com", "subscriptionName": "", "version": "", "signature": "" }
查询通知
请求(Request)
-
请求语法:
GET /v{version}/notification/{name} HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: {utc-date-string} host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: {bce-request-id} content-type: application/json authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
-
请求示例:
GET /v3/notification/mct_notification HTTP/1.1 content-length: 0 accept-encoding: gzip, deflate x-bce-date: 2015-07-03T09:28:13Z connection: keep-alive accept: */* user-agent: python-requests/2.4.0 CPython/2.7.9 Darwin/14.3.0 host: media.bj.baidubce.com x-bce-request-id: 8776558c-81d9-4f97-8e2c-f977a286095d content-type: application/json authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-bce-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Reponse)
- 响应头域:无特殊Header参数
- 响应参数:
字段名称 | 字段类型 | 字段描述 |
---|---|---|
name | String | 通知名称 |
endpoint | String | 通知消息接收地址 |
-
响应示例:
HTTP/1.1 200 OK x-bce-request-id: 8776558c-81d9-4f97-8e2c-f977a286095d Date: Fri, 03 Jul 2015 09:28:13 GMT Transfer-Encoding: chunked Content-Type: application/json;charset=UTF-8 Cache-Control: no-cache { "name" : "mct_notification", "endpoint" : "http://mct.notificaitonDomain.com/" }
删除通知
请求(Request)
-
请求语法:
DELETE /v{version}/notification/{name} HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: {utc-date-string} host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: {bce-request-id} content-type: application/json authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
-
请求示例:
DELETE /v3/notification/mct_notification HTTP/1.1 content-length: 0 accept-encoding: gzip, deflate x-bce-date: 2015-07-03T09:28:13Z connection: keep-alive accept: */* user-agent: python-requests/2.4.0 CPython/2.7.9 Darwin/14.3.0 host: media.bj.baidubce.com x-bce-request-id: 8776558c-81d9-4f97-8e2c-f977a286095d content-type: application/json authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-bce-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Reponse)
- 响应头域:无特殊Header参数
- 响应参数:无
-
响应示例:
HTTP/1.1 200 OK x-bce-request-id: 8776558c-81d9-4f97-8e2c-f977a286095d Date: Fri, 03 Jul 2015 09:28:13 GMT Transfer-Encoding: chunked Content-Type: application/json;charset=UTF-8 Cache-Control: no-cache
通知列表
请求(Request)
-
请求语法:
GET /v{version}/notification HTTP/1.1 accept-encoding: gzip, deflate x-bce-date: {utc-date-string} host: media.bj.baidubce.com accept: */* connection: keep-alive x-bce-request-id: {bce-request-id} content-type: application/json authorization: {bce-authorization-string}
- 请求头域:无特殊Header参数
- 请求参数:无
-
请求示例:
GET /v3/notification HTTP/1.1 content-length: 0 accept-encoding: gzip, deflate x-bce-date: 2015-07-03T09:28:13Z connection: keep-alive accept: */* user-agent: python-requests/2.4.0 CPython/2.7.9 Darwin/14.3.0 host: media.bj.baidubce.com x-bce-request-id: 8776558c-81d9-4f97-8e2c-f977a286095d content-type: application/json authorization: bce-auth-v1/e8e4a9ced6794355a9a1b8a20b58d37b/2015-07-03T09:28:13Z/1800/content-type;host;x-bce-date/4a1692dc4bab84f5801f79ea0c1fece3601cf73ecd94409d2a94b3942b971715
响应(Reponse)
- 响应头域:无特殊Header参数
- 响应参数:
字段名称 | 字段类型 | 字段描述 |
---|---|---|
notifications | Object | 通知列表 |
+ name | String | 通知名称 |
+ endpoint | String | 通知消息接收地址 |
-
响应示例:
HTTP/1.1 200 OK x-bce-request-id: 8776558c-81d9-4f97-8e2c-f977a286095d Date: Fri, 03 Jul 2015 09:28:13 GMT Transfer-Encoding: chunked Content-Type: application/json;charset=UTF-8 Cache-Control: no-cache { "notifications" : [ { "name" : "mct_notification", "endpoint" : "http://mct.notificaitonDomain.com/" }, { "name" : "my_notification", "endpoint" : "http://my.notificaitonDomain.com/" } ] }