Polyv Help Center

Help Center

Query Master Account Billing Statistics

Updated: 2023-07-07 11:51:43

API Description

1、集团账号查询主账号账单
2、接口支持https协议

API URL

http://api.polyv.net/live/v4/group/account/billing-daily/list

<a href="/req.html?api=http://api.polyv.net/live/v4/group/account/billing-daily/list"" target="_blank">Online API Call

Request Method

GET

API Constraints

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

  2. For group account APIs, use the group master account's appId and appSecret when calculating the signature.

  3. The billing period must be after 202204.

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 used to generate the signature is critical for communication data security. It must not be saved or 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 details in Signature Generation Rules
billingDate true String Billing period, format yyyyMM, e.g., 202205. Must be after 202204.
pageSize false Integer Number of items per page, default 10, maximum 1000
pageNumber false Integer Current page number, default 1

Example

http://api.polyv.net/live/v4/group/account/billing-daily/list?appId=g8dtv537aq&timestamp=1653485867000&sign=32389FC010815EDE76028D587FFA6FB3&billingDate=202205

Response Parameter Description

Parameter Type Description
code Integer Status code, same as HTTP status code, used to determine the basic response status
status String Response result, determined by business logic. Returns success on success, error on failure
success Boolean Whether the request was successful
requestId String Request ID, a unique UUID generated for each request. Only for troubleshooting and debugging, not for business logic
error Object Error information when status code is not 200 See details in Error Field Description
data Object Billing list See details in Data Field Description

Error Parameter Description

Parameter Type Description
code Integer Error code, used to identify the specific error reason
desc String Error description, corresponding to error.code

Data Parameter Description

Parameter Type Description
pageNumber Integer Current page number
pageSize Integer Number of items per page
totalPages Long Total number of pages
totalItems Long Total number of items
contents Array Content of the current page See details in Contents Field Description

Contents Parameter Description

Parameter Type Description
unionId String Group master account ID
accountPeriod String Billing period
production String Product: Cloud Live / Cloud VOD
category String Usage type
Cloud Live: Watch minutes / Co-host minutes / Ultra-low latency minutes / Director duration
Cloud VOD: Video playback / Storage space
itemConsumed Float Usage amount
itemConsumedUnit String Usage unit
statAt String Settlement date, daily, format yyyy-MM-dd
tradeType Integer Transaction type
1: Usage settlement
2: Amount settlement
3: Deduction adjustment
4: Refund adjustment

Java Request Example

For quick integration of basic code, download the relevant dependency source code. Click to download 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 pools.

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/billing-daily/list";
    String billingDate = "202205";
    
    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("billingDate", billingDate);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    
    String response = HttpUtil.get(url, requestMap);
    log.info("测试查询主账号账单统计成功:{}", response);
    //do somethings
}

Response Example

For global system error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "requestId": "71c487ed89a94ca0b29e8779ea96f84b.57.16529454016270601",
    "data":
    {
        "pageNumber": 1,
        "pageSize": 10,
        "totalPages": 1,
        "totalItems": 7,
        "contents": [
            {
                "unionId": "******",
                "accountPeriod": "2022-05",
                "email": null,
                "memo": null,
                "production": "直播",
                "category": "导播时长",
                "itemConsumed": 120.00,
                "itemConsumedUnit": "分钟",
                "statAt": "2022-05-12",
                "tradeType": 1
            },
            {
                "unionId": "******",
                "accountPeriod": "2022-05",
                "email": null,
                "memo": null,
                "production": "直播",
                "category": "导播时长",
                "itemConsumed": 80.00,
                "itemConsumedUnit": "分钟",
                "statAt": "2022-05-12",
                "tradeType": 2
            },
            {
                "unionId": "******",
                "accountPeriod": "2022-05",
                "email": null,
                "memo": null,
                "production": "直播",
                "category": "国内观看时长",
                "itemConsumed": 71.00,
                "itemConsumedUnit": "分钟",
                "statAt": "2022-05-16",
                "tradeType": 2
            },
            {
                "unionId": "******",
                "accountPeriod": "2022-05",
                "email": null,
                "memo": null,
                "production": "点播",
                "category": "存储空间",
                "itemConsumed": 0.50,
                "itemConsumedUnit": "GB",
                "statAt": "2022-05-17",
                "tradeType": 2
            },
            {
                "unionId": "******",
                "accountPeriod": "2022-05",
                "email": null,
                "memo": null,
                "production": "直播",
                "category": "国内观看时长",
                "itemConsumed": 88.00,
                "itemConsumedUnit": "分钟",
                "statAt": "2022-05-18",
                "tradeType": 2
            },
            {
                "unionId": "******",
                "accountPeriod": "2022-05",
                "email": null,
                "memo": null,
                "production": "点播",
                "category": "存储空间",
                "itemConsumed": 0.50,
                "itemConsumedUnit": "GB",
                "statAt": "2022-05-18",
                "tradeType": 2
            },
            {
                "unionId": "******",
                "accountPeriod": "2022-05",
                "email": null,
                "memo": null,
                "production": "点播",
                "category": "存储空间",
                "itemConsumed": 0.50,
                "itemConsumedUnit": "GB",
                "statAt": "2022-05-19",
                "tradeType": 2
            }]
    },
    "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "error": {
        "code": 10003,
        "desc": "时间戳过期"
    },
    "success": false
}
联系客服,在线咨询