文章目录
接口URL
https://api.polyv.net/v2/group/vod/set-flow
接口说明
(接口调用有频率限制,详细请查看)
1、集团账号给分账号分配或回收流量接口
2、接口支持https
返回结果支持格式
JSON
请求方式
POST
请求数限制
TRUE
请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在集团账号系统登记的appId |
timestamp | 是 | long | 当前13位毫秒级时间戳,3分钟内有效 |
sign | 是 | string | 签名,为32位大写的MD5值 |
是 | string | 分帐号邮箱 | |
type | 否 | string | 添加-add,回收-recover。默认为add |
flow | 否 | int | 流量数值,单位G |
all | 否 | int | 是否回收所有,1-为回收所有。仅type为recover有效 |
响应成功JSON示例:
{
"code":200,
"status":"success",
"message":"success"
}
响应失败JSON示例:
未输入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
集团账号不存在
{
"code": 400,
"status": "error",
"message": "account not found.",
"data": ""
}
集团账号已被封禁
{
"code": 400,
"status": "error",
"message": "account is forbidden.",
"data": ""
}
时间戳错误
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
签名错误
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
字段说明
参数名 | 说明 |
---|---|
code | 响应代码,成功为200,失败为400,签名错误为401,异常错误500 |
status | 成功为success,失败为error |
message | 错误时为错误提示消息 |
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;
?>