Modify Mobile Authorization Level
Updated: 2025-01-14 16:07:58
API Description
1、通过视频id修改视频的授权方式,支持批量修改
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
API URL
http://api.polyv.net/v2/config/{userid}/hlslevel
<a href="/req.html?api=http://api.polyv.net/v2/config/{userid}/hlslevel"" target="_blank">Online API Call
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure security. API calls have frequency limits. See details
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| ptime | true | Long | Current time in milliseconds, valid for 3 minutes |
| sign | true | String | Signature, a 40-character uppercase SHA1 value. The secretkey 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 and obtain response data. See Signature Generation Rules |
| vids | true | String | Video ID(s). Separate multiple IDs with commas |
| hlslevel | true | String | Video encryption settings open: Non-encrypted authorization web: WEB authorization app: APP authorization wxa_app: Mini Program authorization |
Example
http://api.polyv.net/v2/config/1b448be323/hlslevel
Form Parameters:
vids=1b448be323b68b2999802799a98dba54_1,1b448be323ae991b1dfc5136597618d1_1&encrypt=1&sign=C0850325DE85D49CD0AFF2DD69B799ED45DB2D55&ptime=1617762078215&hlslevel=app
Response Parameters
| 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 additional error details |
| data | Object | On success, returns the number of videos successfully modified |
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 package.
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 pooling.
private static final Logger log = LoggerFactory.getLogger(VodVideoEncryptionTest.class);
/**
* 修改视频的授权方式
*/
@Test
public void testUpdateAuthLevel() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/config/%s/hlslevel", userId);
String vids = "1b448be323b68b2999802799a98dba54_1,1b448be323ae991b1dfc5136597618d1_1";
String hlslevel = "app";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("vids", vids);
requestMap.put("hlslevel", hlslevel);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFormBody(url, requestMap);
log.debug("测试修改视频的授权方式,{}", response);
//do somethings
}
Response Example
See Global Error Description for system-wide error explanations.
Success Example
{
"code": 200,
"status": "success",
"message": "success",
"data": 2
}
Error Example
{
"code": 400,
"status": "error",
"message": "ptime is too old.",
"data": ""
}
