入库相关接口
更新时间:2022-08-25
视频入库
接口描述
本接口用于向视频库中插入视频特征。
- 视频路径支持BOS、HTTP(S) URL路径;
- 入库接口为异步接口,可通过查询视频入库结果接口查询入库结果。或通过通知服务回调结果。
请求结构
Plain Text
1PUT /v{version}/videolib/{libName}
2host: mms.bj.baidubce.com
3Authorization: <bce-authorization-string>
4{
5 "source": videoUrl,
6 "description": desc,
7 "notification": notificationName
8}
请求参数
参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号 |
libName | String | 是 | URL参数 | 用户的视频库名称 |
source | String | 是 | Body参数 | 入库视频的URL |
description | String | 否 | Body参数 | 用户对此次请求的描述 |
notification | String | 否 | Body参数 | 入库结果通知的名称 |
- 注:如使用notification参数,需提前配置通知名称及对应的回调地址。
响应参数
参数名称 | 类型 | 描述 |
---|---|---|
status | String | 请求结果 |
mediaId | String | 视频ID |
请求示例
Plain Text
1PUT /v2/videolib/baiduyun_test
2host: mms.bj.baidubce.com
3Authorization: <bce-authorization-string>
4{
5 "source": "http://test.mp4",
6 "description": "test",
7 "notification": "notification_name"
8}
响应示例
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3{
4 "status": "success",
5 "mediaId": "5kLYVn0BePlv8pCO1RCO"
6}
通知服务回调结果示例
Plain Text
1{
2 "messageId": "a114f8e1-0de0-473f-9f6c-d47e33df5d7d",
3 "messageBody": "{\"taskId\":\"n7CCcHIBTmikKXpp-AS8\",\"status\":\"success\",\"source\":\"http://bj.bcebos.com/v1/bucket/test.mp4\",\"duration\":6.5,\"description\":\"\",\"createTime\":\"2020-06-01T15:32:11Z\",\"startTime\":\"2020-06-01T15:32:11Z\",\"updateTime\":\"2020-06-01T15:32:13Z\",\"finishTime\":\"2020-06-01T15:32:13Z\"}"
4}
查询视频入库结果
接口描述
本接口用于查询视频入库结果。
请求结构
Plain Text
1GET /v{version}/videolib/{libId}?mediaId={mediaId}&getInsertResponseById
2host: mms.bj.baidubce.com
3Authorization: <bce-authorization-string>
请求参数
参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号 |
libId | String | 是 | URL参数 | 用户的视频库ID |
mediaId | String | 是 | URL参数 | 入库视频的ID |
响应参数
参数名称 | 类型 | 描述 |
---|---|---|
status | String | 入库任务状态,取值为provision/processing/success/failed,分别为排队中/处理中/成功/失败 |
description | String | 用户入库请求传入的description字段 |
source | String | 入库视频的URL |
请求示例
Plain Text
1GET /v2/videolib/video_xxx?mediaId={mediaId}&getInsertResponseById
2host: mms.bj.baidubce.com
3Authorization: <bce-authorization-string>
响应示例
入库中
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3{
4 "createTime": "2020-05-13T07:57:25Z",
5 "description": "",
6 "source": "http://bj.bcebos.com/v1/test.mp4",
7 "startTime": "2020-05-13T07:57:26Z",
8 "status": "processing"
9}
入库完成
Plain Text
1HTTP/1.1 200 OK
2Content-Type: application/json;charset=UTF-8
3{
4 "createTime": "2020-05-13T07:55:55Z",
5 "description": "",
6 "duration": 6.5,
7 "finishTime": "2020-05-13T07:55:57Z",
8 "source": "http://bj.bcebos.com/v1/test.mp4",
9 "startTime": "2020-05-13T07:55:55Z",
10 "status": "success"
11}
图片入库
接口描述
本接口用于向图片库中插入图片特征。
- 图片路径支持BOS、HTTP(S) URL路径;
- 图片格式支持jpg、JPG、png、PNG、jpeg、JEPG格式;
请求结构
Plain Text
1PUT /v{version}/imagelib/{libName}
2host: mms.bj.baidubce.com
3Authorization: <bce-authorization-string>
4{
5 "source": imageUrl,
6 "description": desc
7}
请求参数
参数名称 | 类型 | 是否必需 | 参数位置 | 描述 |
---|---|---|---|---|
version | String | 是 | URL参数 | API版本号 |
libName | String | 是 | URL参数 | 用户的图片库名称 |
source | String | 是 | Body参数 | 入库图片的URL |
description | String | 否 | Body参数 | 用户对此次请求的描述 |
响应参数
参数名称 | 类型 | 描述 |
---|---|---|
status | String | 入库结果 |
mediaId | String | 图片ID |
请求示例
Plain Text
1 PUT /v2/imagelib/baiduyun_test
2 host: mms.bj.baidubce.com
3 Authorization: <bce-authorization-string>
4 {
5 "source": "http://test.jpg",
6 "description": "test"
7 }
8
9
10**响应示例**
11
12 HTTP/1.1 200 OK
13 Content-Type: application/json;charset=UTF-8
14 {
15 "status": "success",
16 "mediaId": "ykLlVn0BePlv8pCOv1dX"
17 }