公共请求头域
更新时间:2024-08-30
公共请求头域
公共头域是您调用API时必须填写的HEADER参数。除公共头域外是否还需要填入其他HEADER参数,需要参考具体接口的文档。
公共头域 | 描述 |
---|---|
host | 服务域名。 |
x-bce-date | 表示日期的字符串,符合API规范。 |
authorization | 包含Access Key与请求签名。详见鉴权认证 |
content-type | application/json; charset=utf-8。 |
下面是获取指定媒资信息时的请求头域示例:
GET /v2/medias/<mediaId> HTTP/1.1
accept-encoding: gzip, deflate
x-bce-date: 2024-03-24T13:04:26Z
host: vod.bj.baidubce.com
accept: */*
connection: keep-alive
x-bce-request-id: 47281222-f0ff-4f80-9a4d-0140ff77dcd0
content-type: application/json
authorization: <authorization>
VOD的API服务采用JSON格式的消息体作为响应返回的格式。下面是一个标准的用户查询指定媒资时的完整的请求返回示例:
HTTP/1.1 200 OK
Transfer-Encoding: chunked
x-bce-request-id: 47281222-f0ff-4f80-9a4d-0140ff77dcd0
Cache-Control: no-cache
Server: BWS
Date: Tue, 24 Mar 2024 13:04:27 GMT
Content-Type: application/json;charset=UTF-8
{
"mediaId": "mda-ehhqq89pi6e15n0y",
"name": "demo9.mp4",
"description": "",
"publishStatus": "PUBLISH",
"banStatus": "NORMAL",
"createTime": "2024-03-08T06:52:14Z",
"source": {
"sourceType": "UPLOAD",
"sourceUrl": "https://bj-bos.baidu-int.com/v1/vod-egyrrahca3f80ev6/mda-ehhqq89pi6e15n0y/_src/mda-ehhqq89pi6e15n0y.mp4?authorization=bce-auth-v1%2F213ee4f72b944fdba2e3326af256b781%2F2024-08-21T06%3A15%3A02Z%2F3600%2F%2Fcd8cdfe5c0287a535dbe15628f79df7dcb6734a5602f002cab6742a414305164"
},
"metadata": {
"fileSizeInByte": 5331627,
"type": "video",
"container": "mov,mp4,m4a,3gp,3g2,mj2",
"durationInSecond": 25,
"durationInMillisecond": 24860,
"video": {
"codec": "h264",
"heightInPixel": 720,
"widthInPixel": 1280,
"bitRateInBps": 1085953,
"frameRate": 50.0,
"dar": "16:9"
},
"audio": {
"codec": "flac",
"channels": 1,
"sampleRateInHz": 44100,
"bitRateInBps": 623953
},
"etag": "e2003ba24ed0437e4650a2ac25b70c5c"
}
}