Allocate Live Streaming Minutes API - Group Account 1.0
Updated: 2023-05-04 18:46:13
API Description
1、接口用于分配直播的分钟数
2、接口支持https协议
API URL
http://api.polyv.net/v2/group/live/set-durations
Request Method
POST
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls have frequency limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Group master account appId See Group Account 2.0 Get Secret Key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical information for communication data security. It must not be saved and 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 |
| true | String | Email address of the account to allocate to | |
| type | false | String | Allocation type, add: allocate, recover: reclaim. Default is add |
| duration | true | Integer | Minutes to allocate, an integer greater than 0 |
Example
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure See Global Error Description |
| status | String | Response status text |
| message | String | Response description message, when code is 400 or 500, provides auxiliary error reason |
| data | String | Returns "success" on successful request, empty string on failure |
PHP Request Example
<?php
//引用config-group.php
include 'config-group.php';
$params = array(
'appId' => $appId,
'email' => $email,
'type' => $type,
'durations' => $durations,
'timestamp' => $timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "https://api.polyv.net/v2/group/live/set-durations?".http_build_query($params);
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 0);
$res = curl_exec($curl);
curl_close($curl);
echo $res;
?>
Response Example
Success Example
{
"code": 200,
"status": "success",
"message": "success",
"data": "success"
}
Error Example
{
"code": 400,
"status": "error",
"message": "已超过账号可使用上限",
"data": ""
}
