Polyv Help Center

Help Center

Assign Sub-Account Traffic Interface - Group Account 1.0

Updated: 2023-05-04 18:48:04

Interface Description

1、集团账号给分账号分配或回收流量接口
2、接口支持https协议

Interface URL

http://api.polyv.net/v2/group/vod/set-flow

Request Method

POST

Interface Constraints

  1. The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Group master account appId See details in Group Account 2.0 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 information for communication data security. It must not be saved or used directly on the client side. All APIs must be relayed through the customer's own server to the POLYV server for response data. See details in Signature Generation Rules
email true String Sub-account email
type false String Add - add, Recover - recover. Default is add
all false Integer Whether to recover all, 1 - recover all. Only valid when type is recover

Example


Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for successful return, non-200 for failure See details in Global Error Description
status String Response status text information
message String Response description information, assists in describing error reasons when code is 400 or 500
data String Returns success on successful request, empty string on request failure

PHP Request Example

<?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;
?>

Response Example

Success Example

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

Error Example

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