修改事件回调设置
更新时间:2025-01-14
VOD服务为客户提供了媒资上传、媒资处、视频生成理等一系列功能。在服务执行过程中或执行结束后,VOD会触发各种事件通知,以便开发者及时了解服务处理状态,并执行后续业务逻辑。
通过本接口,开发者可以实现:
- 修改接收回调通知地址
- 开启/关闭通知的签名
- 开启/关闭特定事件接收回调通知
以上参数可以在单个请求中同时修改,也可以部分修改。
请求结构
PUT /v2/callback HTTP/1.1
connection: keep-alive
host: vod.bj.baidubce.com
content-type: application/json
x-bce-request-id: <bce-request-id>
x-bce-date: <utc-date-string>
authorization: <bce-authorization-string>
{
// 要修改的回调设置参数
}
请求头域
除公共头域外,无其它特殊头域。
请求参数
参考 CallbackConfig 结构定义,每个参数都可选。
返回头域
除公共头域,无其它特殊头域。
返回参数
示例
修改回调地址
请求内容
PUT /v2/callback HTTP/1.1
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
content-type: application/json
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1d481
x-bce-date: 2024-03-24T13:08:44Z
authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2024-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9
{
"callbackUrl": "http://aaaa.com/callback",
}
返回内容
HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1d481
Cache-Control: no-cache
Date: Tue, 24 Mar 2024 13:08:44 GMT
Content-Type: application/json;charset=UTF-8
开启回调签名
请求内容
PUT /v2/callback HTTP/1.1
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
content-type: application/json
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1d481
x-bce-date: 2024-03-24T13:08:44Z
authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2024-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9
{
"enableSign": true,
"signKey": "123qwe",
}
返回内容
HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1d481
Cache-Control: no-cache
Date: Tue, 24 Mar 2024 13:08:44 GMT
Content-Type: application/json;charset=UTF-8
开启特定事件接收回调通知
请求内容
PUT /v2/callback HTTP/1.1
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
content-type: application/json
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1
x-bce-date: 2024-03-24T13:08:44Z
authorization: bce-auth-v1/46bd9968a6194b4bbdf0341f2286ccce/2024-03-24T13:08:44Z/1800/host;x-bce-date/7e21c9cf1e4e2cc6921a407a388fe98df122c53b9f509043d841be76eb09a1f9
{
"enableMediaUploadCompleteEvent": true,
"enableMediaTranscodeCompleteEvent": true,
"enableVideoGenerateCompleteEvent": true
}
返回内容
HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 6bae5cb3-97d1-4b1a-b8b6-0ad577c1d481
Cache-Control: no-cache
Date: Tue, 24 Mar 2024 13:08:44 GMT
Content-Type: application/json;charset=UTF-8
错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见公共错误码。
错误码 | 错误信息 | HTTP状态码 | 描述 |
---|---|---|---|
InvalidCallbackConfigParams | signKey is required when enable sign | 400 | 开启签名时,signKey不能为空 |
InvalidCallbackConfigParams | callbackUrl is required when enable any event | 400 | 开启事件回调时,回调地址不能为空 |
InvalidCallbackConfigParams | callbackUrl is not allowed | 403 | 回调地址不允许使用 |