Query Playlist Details
Updated: 2022-09-02 18:08:07
API Description
1、通过播放列表id查询用户视频播放列表详情信息
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口URL中的{id}为点播账号播放列表id,具体参考【获取所有播放列表】
4、接口支持https协议
API URL
http://api.polyv.net/v2/play/{userid}/list/{id}
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| userid | true | String | POLYV VOD account ID. Refer to Get Secret Key for acquisition. Path: Official Website -> Login -> VOD (API Interface) |
| ptime | true | Long | Current time in milliseconds timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 40-character uppercase SHA1 value. The secretkey used to generate the signature is critical for data communication security. It must not be stored or used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server for response data. See Signature Generation Rules |
| id | true | String | Playlist ID. Can be obtained via Get All Playlists |
| format | false | String | Response data format. Default is JSON. xml: Returns XML format json: Returns JSON format |
Example
http://api.polyv.net/v2/play/1b448be323/list/1617177069967?format=json&sign=2F6FC9DE4F3901D654B85E92FE98A30AC07CE316&id=1617177069967&userid=1b448be323&ptime=1617183364138
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure. See Global Error Codes |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides additional error details |
| data | Array | Video details on success. See data field description |
data Parameters
| Field | Type | Description |
|---|---|---|
| describ | String | Playlist description |
| tag | String | Playlist tag |
| title | String | Playlist title |
| lmodify | String | Last modification time, format: yyyy-MM-dd HH:mm:ss |
| video_count | String | Number of videos in the playlist |
| videoid | String | Playlist ID |
| ptime | String | Creation time, format: yyyy-MM-dd HH:mm:ss |
| videolist | Array | Video collection. See videolist parameter description |
videolist Parameters
| Field | Type | Description |
|---|---|---|
| vid | String | Video ID |
| title | String | Video title |
| duration | String | Video duration, format: HH:mm:ss, e.g., 00:03:11 |
| publish_url | String | External link |
| first_image | String | Video thumbnail |
| default_videolink | String | Default video link |
Java Request Example
For quick integration, download the relevant dependency source code. Click to download source code. After downloading, add it to your project. The test cases include HttpUtil.java and VodSignUtil.java in the downloaded file.
It is strongly recommended to use the VOD Java SDK for API integration. The VOD Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(VodPlaylistTest.class);
/**
* 查询播放列表详情
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testGetPlaylistDetail() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String id = "1617177069967";
String format = "json";
String url = String.format("http://api.polyv.net/v2/play/%s/list/%s", userId, id);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userId);
requestMap.put("ptime", ptime);
requestMap.put("id", id);
requestMap.put("format", format);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.get(url, requestMap);
log.debug("测试查询播放列表详情,{}", response);
//do somethings
}
Response Example
For global error codes, see Global Error Codes
Success Example
{
"code": 200,
"status": "success",
"message": "success",
"data": [
{
"describ": "测试修改描述",
"tag": "测试标签",
"title": "测试创建播放列表接口123",
"lmodify": "2021-03-31 17:13:21",
"video_count": "1",
"videoid": "1617177069967",
"ptime": "2021-03-31 15:51:09",
"videolist": [
{
"vid": "1b448be323b8d9b9489dcd7e8e09f087_1",
"title": "测试视频-jjjjj",
"duration": "00:02:19",
"publish_url": "",
"first_image": "http://img.videocc.net/uimage/1/1b448be323/7/1b448be323b8d9b9489dcd7e8e09f087_0.jpg",
"default_videolink": ""
}
]
}
]
}
Error Example
Incorrect signature
{
"code": 400,
"status": "error",
"message": "the sign is not right",
"data": ""
}
