Polyv Help Center

Help Center

Modify Video Library Sorting

Updated: 2022-09-02 18:08:07

API Description

1、修改视频库回放列表的视频排序
2、(channelId, listType, timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议

API URL

http://api.polyv.net/live/v3/channel/playback/sort

Online API Call

Request Method

POST

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls are subject to rate limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid within 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never be saved or used directly on the client side. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See Signature Generation Rules
channelId true String Channel ID
listType false String Sorting list type. Default is vod for regular live streaming, playback for three-screen layout.
playback: Playback list
vod: VOD list

Request Body Parameter Description

Parameter Required Type Description
videoIds true String[] Complete video ID list. The number of requested video IDs must match the number of videos in the playback list. Submit in JSON format via request body.
Format example: {"videoIds": ["40b5fc215e","2ce845def0", "73801f70c8"]}

Example

https://api.polyv.net/live/v3/channel/playback/sort?appId=frlr1zazn3&sign=840FF35DB291A8C010F7CE14A0A985CA&listType=vod&channelId=2139283&timestamp=1621841731282

Request body parameters:

{
    "videoIds":[
        "40b5fc215e",
        "2ce845def0",
        "73801f70c8"
    ]
}

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See Global Error Description
status String Response status text
message String Response description. When code is 400 or 500, provides auxiliary error reason description.
data String Returns an empty string regardless of success or failure

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source code project. The HttpUtil.java and LiveSignUtil.java in the test cases are included in the downloaded file.

It is strongly recommended to use the Live Java SDK for API integration. The Live 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(ChannelPlayBackTest.class);
/**
 * 修改视频库的视频排序
 * @throws IOException
 * @throws NoSuchAlgorithmException
 */
@Test
public void testSetPlaybackSort() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = super.appId;
    String appSecret = super.appSecret;
    String userId = super.userId;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "https://api.polyv.net/live/v3/channel/playback/sort";
    String channelId = "2139283";
    String videoIds = "{\"videoIds\": [\"40b5fc215e\",\"2ce845def0\", \"73801f70c8\"]}";
    String listType = "vod";
    
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("channelId", channelId);
    requestMap.put("listType", listType);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    url = HttpUtil.appendUrl(url, requestMap);
    String response = HttpUtil.postJsonBody(url, videoIds, null);
    log.info("测试修改视频库的视频排序,返回值:{}", response);
    //do somethings
    
}

Response Example

For system global error descriptions, see Global Error Description

Success Example

{
    "code":200,
    "status":"success",
    "message":"",
    "data":""
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询