分配子帳號流量介面-集團帳號1.0
更新時間:2023-05-04 18:48:04
介面描述
1、集团账号给分账号分配或回收流量接口
2、接口支持https协议
介面URL
http://api.polyv.net/v2/group/vod/set-flow
請求方式
POST
介面限制
1、介面同時支援HTTP、HTTPS,建議使用HTTPS確保介面安全,介面呼叫有頻率限制,詳細請查看
請求參數說明
| 參數名 | 必填 | 類型 | 說明 |
|---|---|---|---|
| appId | true | String | 集團主帳號appId【詳見集團帳號2.0取得金鑰】 |
| timestamp | true | Long | 當前13位毫秒級時間戳,3分鐘內有效 |
| sign | true | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則】 |
| true | String | 子帳號信箱 | |
| type | false | String | 新增-add,回收-recover。預設為add |
| all | false | Integer | 是否回收所有,1-為回收所有。僅type為recover有效 |
範例
回應參數說明
| 參數名 | 類型 | 說明 |
|---|---|---|
| code | Integer | 回應狀態碼,200為成功返回,非200為失敗【詳見全域錯誤說明】 |
| status | String | 回應狀態文字資訊 |
| message | String | 回應描述資訊,當code為400或500時,輔助描述錯誤原因 |
| data | String | 請求成功返回success,請求失敗為空字串 |
php請求範例
<?php
//引用config.php
include 'config-group.php';
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'email' => 'email@polyv.net',
'type' => 'recover',
'all' => '1'
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "https://api.polyv.net/v2/group/vod/set-flow?".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;
?>
回應範例
成功範例
{
"code":200,
"status":"success",
"message":"success"
}
異常範例
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
