Get Allocation Records
API Description
1、集团账号给分账号分配资源之后,能够通过接口获取分账号的资源
2、(timestamp, appId)参与sign签名,并和sign一起通过url传递,请求体参数不参与签名,通过post请求体传递【请设置请求头contentType:application/json】
3、接口支持https协议
API URL
http://api.polyv.net/live/v4/group/account/allocation-log/list
Request Method
GET
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls have frequency limits. See details
For group account API signature calculation, use the appId and appSecret of the primary group account.
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Primary group account appId See Group Account 2.0 Key Acquisition |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 3 minutes |
| sign | true | String | Signature, a 32-character uppercase MD5 value. The appSecret used for signature generation is critical for communication data security and must never be used directly on the client side. All APIs must be relayed through the customer's own server to call the POLYV server for response data. See Signature Generation Rules |
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| emails | true | String | Sub-account emails, separated by commas for multiple accounts. Maximum 200 per request. |
| depositStartTime | false | String | Start time, format: yyyy-MM-dd HH:mm:ss |
| depositEndTime | false | String | End time, format: yyyy-MM-dd HH:mm:ss |
| resourceCode | false | String | Resource code. Currently supported resources: balance: Amount minutes: Live streaming minutes parallelConcurrent: Live parallel concurrency totalConcurrent: Live cumulative concurrency channels: Live streaming channels linkMicDuration: Mic connection minutes guideDuration: Director console minutes vodFlow: VOD traffic vodSpace: VOD storage groupUserCount: Number of sub-accounts |
| alterationType | false | String | Change type. 0: Allocation 1: Recovery 2: Expiration reset |
| pageNumber | true | Integer | Page number, default is 1 |
| pageSize | true | Integer | Page size, default is 10 |
Example
http://api.polyv.net/live/v4/group/account/allocation-log/list?appId=g8dtv537aq×tamp=1653485867000&sign=32389FC010815EDE76028D587FFA6FB3&emails=*****1@polyv.net,*****2@polyv.net
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| String | Sub-account email | |
| note | String | Sub-account note |
| depositTime | String | Allocation time |
| resourceCode | String | Resource code. balance: Amount minutes: Live streaming minutes parallelConcurrent: Live parallel concurrency totalConcurrent: Live cumulative concurrency channels: Live streaming channels linkMicDuration: Mic connection minutes guideDuration: Director console minutes vodFlow: VOD traffic vodSpace: VOD storage groupUserCount: Number of sub-accounts |
| alterationType | String | Change type. 0: Allocation 1: Recovery 2: Expiration reset |
| alteration | String | Change amount, always positive. VOD traffic and VOD storage are in GB. |
| pageNumber | Integer | Page number |
| pageSize | Integer | Page size |
Error Parameters
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to identify the specific error reason |
| desc | String | Error description, corresponding to error.code |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source code project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded file.
It is strongly recommended to use the Live Java SDK for API integration. The Live 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(ChannelOperateTest.class);
/**
* 查询集团账号分配记录
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void groupAccountBillingTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.groupAppId;
String appSecret = super.groupAppSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "http://api.polyv.net/live/v4/group/account/allocation-log/list";
String emails = "*****1@polyv.net,*****1@polyv.net,*****2@polyv.net";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("emails", emails);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("查询集团账号分配记录成功:{}", response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Descriptions
Success Example
{
"code": 200,
"status": "success",
"requestId": "8c0fba9599094d30925ddbd6d6996f6b.63.16902751078127303",
"data": {
"pageNumber": 1,
"pageSize": 20,
"totalPages": 1,
"totalItems": 10,
"contents": [
{
"email": "******@polyv.net",
"resourceCode": "channels",
"alteration": "96",
"depositTime": "2023-01-12 23:47:44",
"note": "sss",
"alterationType": 1
},
{
"email": "********@polyv.net",
"resourceCode": "channels",
"alteration": "98",
"depositTime": "2023-01-12 23:47:36",
"note": "ss",
"alterationType": 0
}
]
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"error": {
"code": 10003,
"desc": "时间戳过期"
},
"success": false
}
