搜索媒资
更新时间:2024-12-16
本接口用于搜索媒资列表,搜索结果返回媒资分页结果,媒资信息仅包含基础信息。
搜索媒资支持多种检索条件,包括:
- 媒资名称
- 媒资类型
- 媒资ID
- 媒资来源
- 媒资创建时间
- 封禁状态
- 媒资分类
- 媒资标签
接口限制:
- marker 和 maxSize 两个参数影响单次分页查询结果数。特别注意:当这2个值都缺省时,本接口最多只返回前10条查询结果。
请求结构
GET /v2/medias?{请求参数} 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>
请求头域
除公共头域外,无其它特殊头域。
请求参数
参数 | 类型 | 是否必需 | 参数位置 | 描述 |
---|---|---|---|---|
marker | string | 否 | Query参数 | 本次请求的marker,标记查询的起始位置,是上次marker机制查询返回的nextMarker,首次查询不提供本字段 |
maxSize | string | 否 | Query参数 | 本次请求返回的媒资列表的最大元素个数,支持范围:[1-1000],默认值:10 |
name | string | 否 | Query参数 | 媒资名称,支持模糊匹配 |
mediaTypes | string[] | 否 | Query参数 | 媒资类型,支持:video、audio、image |
mediaId | string | 否 | Query参数 | 媒资ID |
sourceType | string | 否 | Query参数 | 媒资来源,支持:
|
banStatus | string | 否 | Query参数 | 封禁状态,支持:
|
categoryIds | string[] | 否 | Query参数 | 媒资分类ID列表 |
tags | string[] | 否 | Query参数 | 媒资标签列表 |
beginTime | string | 否 | Query参数 | 媒资创建时间的开始时间,大于等于开始时间,格式参考日期与时间规范 |
endTime | string | 否 | Query参数 | 媒资创建时间的开始时间,小于等于结束时间,格式参考日期与时间规范 |
返回头域
除公共头域,无其它特殊头域。
返回参数
参数 | 类型 | 描述 |
---|---|---|
isTruncated | boolean | 下一页是否还有数据 |
marker | string | 当前页查询的marker |
nextMarker | string | 查询下一页的marker |
data | MediaBasicInfo[] | 此页数据 |
示例
根据创建时间范围搜索媒资
第一次搜索时不需要指定marker,从起始开始搜索。
请求内容
GET /v2/medias?maxSize=2&begin=2024-09-11T12:18:30Z&end=2024-09-13T12:18:30Z 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
返回内容
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
{
"data": [
{
"mediaId": "mda-fhepatsnpn4rk9zk",
"name": "vod1.mp4",
"banStatus": "NORMAL",
"createTime": "2024-09-11T13:44:41Z",
"source": {
"sourceType": "UPLOAD",
"sourceUrl": "https://bj-bos.baidu-int.com/v1/vod-egyrrahca3f80ev6/mda-fhepatsnpn4rk9zk/_src/mda-ehwth0gvkaj8c53z.mp4?authorization=bce-auth-v1%2F213ee4f72b944fdba2e3326af256b781%2F2024-08-21T12%3A20%3A28Z%2F3600%2F%2Fd575aaebfe4e164b94e3146bc245f594dedccd1b8f467d816cc35039e3f9c980",
"coverUrl": "https://bj-bos.baidu-int.com/v1/vod-egyrrahca3f80ev6/mda-fhepatsnpn4rk9zk/ehwty5yu7pn7nxqc7rde/ehwttwiu8p6eyas1e7aj/mda-ehwth0gvkaj8c53z.jpg?authorization=bce-auth-v1%2F213ee4f72b944fdba2e3326af256b781%2F2024-08-21T12%3A20%3A28Z%2F3600%2F%2Fee70350a7d12e56ba9efd9ad9c0ece4009e72aa7b28eeb3595fae433beb09caf"
},
"categoryId": "system",
"sourceMetadata": {
"fileSizeInByte": 2443128,
"type": "video",
"container": "mov,mp4,m4a,3gp,3g2,mj2",
"durationInSecond": 4,
"durationInMillisecond": 4410,
"video": {
"codec": "h264",
"heightInPixel": 720,
"widthInPixel": 1280,
"bitRateInBps": 4388595,
"frameRate": 24.0,
"dar": "16:9"
},
"audio": {
"codec": "aac",
"channels": 1,
"sampleRateInHz": 44100,
"bitRateInBps": 69574
},
"etag": "ba7247de26535e57f0fff4c2a80fe08e"
}
},
{
"mediaId": "mda-ehwkurnbbirnxfrr",
"name": "vod2.mp4",
"banStatus": "NORMAL",
"createTime": "2024-09-13T02:13:11Z",
"categoryId": "ek1knxq4san4617d8bux",
"source": {
"sourceType": "UPLOAD",
"sourceUrl": "https://bj-bos.baidu-int.com/v1/vod-egyrrahca3f80ev6/mda-ehwkurnbbirnxfrr/_src/mda-ehwkurnbbirnxfrr.mp4?authorization=bce-auth-v1%2F213ee4f72b944fdba2e3326af256b781%2F2024-08-21T12%3A20%3A28Z%2F3600%2F%2F75d21aee4ff0a92b22fa1da58b5f7721501666e56ac0994c3a138f197d0d0436"
},
"sourceMetadata": {
"fileSizeInByte": 2443128,
"type": "video",
"container": "mov,mp4,m4a,3gp,3g2,mj2",
"durationInSecond": 4,
"durationInMillisecond": 4410,
"video": {
"codec": "h264",
"heightInPixel": 720,
"widthInPixel": 1280,
"bitRateInBps": 4388595,
"frameRate": 24.0,
"dar": "16:9"
},
"audio": {
"codec": "aac",
"channels": 1,
"sampleRateInHz": 44100,
"bitRateInBps": 69574
},
"etag": "ba7247de26535e57f0fff4c2a80fe08e"
}
}
],
"marker": "mda-fhepatsnpn4rk9zk",
"nextMarker": "mda-ehgr5pdgv6fsedqj",
"isTruncated": true
}
返回结果的isTruncated为true,表示还有下一页数据。如果要继续搜索,需要再下一次请求Query指定marker为本次请求返回的nextMarker,即marker=mda-ehgr5pdgv6fsedqj
。
根据分类ID搜索媒资
请求内容
GET /v2/medias?maxSize=2&categoryIds=system,ek1knxq4san4617d8bux 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
返回内容
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
{
"data": [
{
"mediaId": "mda-fhepatsnpn4rk9zk",
"name": "vod1.mp4",
"banStatus": "NORMAL",
"createTime": "2024-09-11T13:44:41Z",
"categoryId": "system",
"source": {
"sourceType": "UPLOAD",
"sourceUrl": "https://bj-bos.baidu-int.com/v1/vod-egyrrahca3f80ev6/mda-fhepatsnpn4rk9zk/_src/mda-ehwth0gvkaj8c53z.mp4?authorization=bce-auth-v1%2F213ee4f72b944fdba2e3326af256b781%2F2024-08-21T12%3A20%3A28Z%2F3600%2F%2Fd575aaebfe4e164b94e3146bc245f594dedccd1b8f467d816cc35039e3f9c980",
"coverUrl": "https://bj-bos.baidu-int.com/v1/vod-egyrrahca3f80ev6/mda-fhepatsnpn4rk9zk/ehwty5yu7pn7nxqc7rde/ehwttwiu8p6eyas1e7aj/mda-ehwth0gvkaj8c53z.jpg?authorization=bce-auth-v1%2F213ee4f72b944fdba2e3326af256b781%2F2024-08-21T12%3A20%3A28Z%2F3600%2F%2Fee70350a7d12e56ba9efd9ad9c0ece4009e72aa7b28eeb3595fae433beb09caf"
},
"sourceMetadata": {
"fileSizeInByte": 2443128,
"type": "video",
"container": "mov,mp4,m4a,3gp,3g2,mj2",
"durationInSecond": 4,
"durationInMillisecond": 4410,
"video": {
"codec": "h264",
"heightInPixel": 720,
"widthInPixel": 1280,
"bitRateInBps": 4388595,
"frameRate": 24.0,
"dar": "16:9"
},
"audio": {
"codec": "aac",
"channels": 1,
"sampleRateInHz": 44100,
"bitRateInBps": 69574
},
"etag": "ba7247de26535e57f0fff4c2a80fe08e"
}
},
{
"mediaId": "mda-ehwkurnbbirnxfrr",
"name": "vod2.mp4",
"banStatus": "NORMAL",
"createTime": "2024-09-13T02:13:11Z",
"categoryId": "ek1knxq4san4617d8bux",
"source": {
"sourceType": "UPLOAD",
"sourceUrl": "https://bj-bos.baidu-int.com/v1/vod-egyrrahca3f80ev6/mda-ehwkurnbbirnxfrr/_src/mda-ehwkurnbbirnxfrr.mp4?authorization=bce-auth-v1%2F213ee4f72b944fdba2e3326af256b781%2F2024-08-21T12%3A20%3A28Z%2F3600%2F%2F75d21aee4ff0a92b22fa1da58b5f7721501666e56ac0994c3a138f197d0d0436"
},
"sourceMetadata": {
"fileSizeInByte": 2443128,
"type": "video",
"container": "mov,mp4,m4a,3gp,3g2,mj2",
"durationInSecond": 4,
"durationInMillisecond": 4410,
"video": {
"codec": "h264",
"heightInPixel": 720,
"widthInPixel": 1280,
"bitRateInBps": 4388595,
"frameRate": 24.0,
"dar": "16:9"
},
"audio": {
"codec": "aac",
"channels": 1,
"sampleRateInHz": 44100,
"bitRateInBps": 69574
},
"etag": "ba7247de26535e57f0fff4c2a80fe08e"
}
}
],
"marker": "mda-fhepatsnpn4rk9zk",
"nextMarker": "mda-ehgr5pdgv6fsedqj",
"isTruncated": true
}
错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见公共错误码。
错误码 | 错误信息 | HTTP状态码 | 描述 |
---|---|---|---|
MediaCategoryNotFound | category not found: xxx | 404 Not Found | 分类不存在 |