音视频点播VOD

    通知接口

    通知格式

    VOD通过HTTP请求将通知消息POST到您所配置的通知接口,用户通知接口收到的HTTP POST请求BODY示例:

    媒资转码成功时通知接口示例:

    {
        "messageId": "319519d9-722c-44ea-a352-3ea88fc2696c",
        "messageBody": "{\"mediaId\":\"mda-hdnrx2nnwx45w0wf\",\"status\":\"PUBLISHED\",\"attributes\":{\"title\":\"vod_test.mp4\",\"description\":\"\",\"sourceExtension\":\"mp4\"},\"meta\":{\"sourceSizeInBytes\":6408195,\"durationInSeconds\":25,\"sizeInBytes\":8286486},\"publishTime\":\"2017-04-13T07:45:36Z\",\"createTime\":\"2017-04-13T07:45:12Z\",\"playableUrlList\":[{\"transcodingPresetName\":\"test_1\",\"url\":\"http://gcikci7rzd3nstav8xw.exp.bcevod.com/mda-hdnrx2nnwx45w0wf/test1/mda-hdnrx2nnwx45w0wf.mp4\",\"meta\":{\"sizeInBytes\":626688,\"durationInSeconds\":25,\"bitRateInBps\":199680,\"frameRate\":30.0,\"widthInPixel\":320,\"heightInPixel\":180}},{\"transcodingPresetName\":\"testtest\",\"url\":\"http://gcikci7rzd3nstav8xw.exp.bcevod.com/mda-hdnrx2nnwx45w0wf/testtest/mda-hdnrx2nnwx45w0wf.mp4\",\"meta\":{\"sizeInBytes\":624640,\"durationInSeconds\":25,\"bitRateInBps\":199680,\"frameRate\":30.0,\"widthInPixel\":480,\"heightInPixel\":270}},{\"transcodingPresetName\":\"test_2\",\"url\":\"http://gcikci7rzd3nstav8xw.exp.bcevod.com/mda-hdnrx2nnwx45w0wf/test2/mda-hdnrx2nnwx45w0wf.mp4\",\"meta\":{\"sizeInBytes\":625664,\"durationInSeconds\":25,\"bitRateInBps\":199680,\"frameRate\":30.0,\"widthInPixel\":480,\"heightInPixel\":270}}],\"thumbnailList\":[\"http://gcikci7rzd3nstav8xw.exp.bcevod.com/mda-hdnrx2nnwx45w0wf/mda-hdnrx2nnwx45w0wf.jpg\"],\"transcodingPresetGroupName\":\"test\"}",
        "notification": "notification_test",
        "server": "vod.baidubce.com",
        "subscriptionName": "ntf-hdnrd5t443umxk2d",
        "version": "v0.1",
        "signature": "vod"
    }

    媒资转码失败时通知接口示例:

    {
        "messageId":"onlinebj-topic-82466_1-1",
        "messageBody":"{\"mediaId\":\"mda-gkfx8ua2yb68b002\",\"status\":\"FAILED\",\"attributes\":{\"title\":\"HelloWorld\",\"description\":\"HelloWorldDesc\",\"sourceExtension\":\"\"},\"meta\":{\"sourceSizeInBytes\":11340,\"durationInSeconds\":0,\"sizeInBytes\":11340},\"createTime\":\"2016-11-06T13:05:17Z\",\"error\":{\"code\":\"TRANSCODING_FAILED\",\"message\":\"Invalid input data\"},\"playableUrlList\":[{\"url\":\"http://gedftnj8mkvfefua333.exp.bcevod.com/mda-gkfx8ua2yb68b002/mda-gkfx8ua2yb68b002.mp4\"}],\"thumbnailList\":[\"http://gedftnj8mkvfefua333.exp.bcevod.com/mda-gkfx8ua2yb68b002/mda-gkfx8ua2yb68b002.jpg\"]}",
    	"subscriptionName":"ntf-gggj7xr8yp27hjz4",
        "version":"v1alpha",
        "signature":"QNS signature"
    }

    messageBody字段的值为字符串类型,可以通过常用的JSON库转为标准的JSON格式。

    字段说明:

    字段 描述
    messageBody 字段的值为字符串类型,可以通过常用的JSON库转为标准的JSON格式。结构与“查询指定媒资”相同
    subscriptionName 本条通知对应的通知名称
    version 通知服务器的版本
    signature 本条通知的签名

    创建通知

    通过指定通知名称和通知消息接收地址来创建通知,在媒资状态转换时主动向开发者服务器推送消息。每个通知名称在用户空间唯一,每个用户最多可以创建5个通知接口。

    请求语法

    POST /v<version>/notification HTTP/1.1
    accept-encoding: gzip, deflate
    x-bce-date: <utc-date-string>
    host: vod.bj.baidubce.com
    accept: */*
    connection: keep-alive
    x-bce-request-id: <bce-request-id>
    content-type: application/json
    authorization: <bce-authorization-string>

    请求参数

    参数 类型 描述 是否必须
    name String 通知名称。小写字母开头、由小写字母、下划线(_)、数字组成的长度不超过40的字符串
    endpoint String 通知消息接收地址。长度不超过256字符,不支持https格式

    请求示例

    POST /v1/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: vod.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": "vod_notification",
      "endpoint": "http://vod.notificaitonDomain.com/"
    }

    响应头域

    无特殊响应头域。

    响应参数

    响应示例

    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

    查询通知

    查询特定通知的详细信息。

    请求语法

    GET /v<version>/notification/<notificationName> HTTP/1.1
    accept-encoding: gzip, deflate
    x-bce-date: <utc-date-string>
    host: vod.bj.baidubce.com
    accept: */*
    connection: keep-alive
    x-bce-request-id: <bce-request-id>
    content-type: application/json
    authorization: <bce-authorization-string>

    请求参数

    参数 类型 描述 是否必须
    name String 通知名称

    请求示例

    GET /v1/notification/vod_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: vod.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 String 通知名称
    endpoint String 通知消息接收地址
    createTime Date 通知创建时间

    响应示例

    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" : "vod_notification",
      "endpoint" : "http://vod.notificaitonDomain.com/",
      "createTime" : "2015-08-05T12:09:31Z"
    }

    通知列表

    查询用户的全部通知的详细信息。

    请求语法

    GET /v<version>/notification HTTP/1.1
    accept-encoding: gzip, deflate
    x-bce-date: <utc-date-string>
    host: vod.bj.baidubce.com
    accept: */*
    connection: keep-alive
    x-bce-request-id: <bce-request-id>
    content-type: application/json
    authorization: <bce-authorization-string>

    请求参数

    无。

    请求示例

    GET /v1/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: vod.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

    响应头域

    无特殊响应头域。

    响应参数

    参数 类型 描述
    notifications Object 通知列表
    name String 通知名称(notifications子参数)
    endpoint String 通知消息接收地址(notifications子参数)
    createTime Date 通知创建时间(notifications子参数)

    响应示例

    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" : "vod_notification",
        "endpoint" : "http://vod.notificaitonDomain.com/",
        "createTime" : "2015-08-05T12:09:31Z"
      }, {
        "name" : "my_notification",
        "endpoint" : "http://my.notificaitonDomain.com/",
        "createTime" : "2015-08-05T12:09:31Z"
      } ]
    }

    删除通知

    删除指定通知。

    请求语法

    DELETE /v<version>/notification/<notificationName> HTTP/1.1
    accept-encoding: gzip, deflate
    x-bce-date: <utc-date-string>
    host: vod.bj.baidubce.com
    accept: */*
    connection: keep-alive
    x-bce-request-id: <bce-request-id>
    content-type: application/json
    authorization: <bce-authorization-string>

    请求参数

    参数 类型 描述 是否必须
    name String 通知名称

    请求示例

    DELETE /v1/notification/vod_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: vod.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

    响应头域

    无特殊响应头域。

    响应参数

    无。

    响应示例

    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
    上一篇
    策略组接口
    下一篇
    统计接口