Polyv Help Center

Help Center

Query Sub-Account Statistics Aggregate Data

Updated: 2022-09-02 18:08:07

Interface Description

1、按日期查询子账号统计汇总数据
2、接口userid为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议

Interface URL

https://api.polyv.net/v2/sub-account/stats/agg/page

Online API Call

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
userid true String POLYV VOD account ID. Refer to Get Secret Key for acquisition. Path: Official Website -> Login -> VOD (Development Settings)
ptime true Long Current time in milliseconds, valid within 3 minutes
sign true String Signature, a 40-character uppercase SHA1 value. See Signature Generation Rules for details
startDate true String Start date, format: yyyy-MM-dd, e.g., 2021-04-07. Time span cannot exceed one year
endDate true String End date, format: yyyy-MM-dd, e.g., 2021-04-10. Time span cannot exceed one year
page false Integer Page number, default is 1
pageSize false Integer Items per page, default is 20, maximum is 100
email false String Sub-account email to query. If both email and appId are provided, email takes priority
appId false String Sub-account appId to query

Example

http://api.polyv.net/v2/sub-account/stats/agg/page

Form parameters:

sign=25B8ED6CD0AF4E0058D44DA5D395A569701328F9&ptime=1623056999195&userid=cca90d24f7&startDate=2021-05-01&endDate=2021-06-01

Response Parameter Description

Parameter Type Description
code Integer Response status code. 200 indicates success, non-200 indicates failure. See Global Error Description
status String Response status text
message String Response description. When code is 400 or 500, provides auxiliary error reason
data Object Returns sub-account statistics aggregate data on success. See data field description
data parameter description
Parameter Type Description
pageNumber Integer Current page number
totalPages Integer Total number of pages
totalItems Integer Total number of items
pageSize Integer Items per page
contents Array List of sub-account aggregate data. See contents field description

contents Field Description

Field Type Description
email String Sub-account email. If the sub-account is deleted, this field is null
appId String Sub-account appId
flowSize Long Traffic used within the query period, unit: byte
view Long Play count, unit: count
duration Long Play duration, unit: seconds

Java Request Example

For quick integration of basic code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. HttpUtil.java and VodSignUtil.java in the test case are included in the download file.

It is strongly recommended to use the VOD Java SDK for API functionality integration. The VOD Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools, greatly improving B-end integration speed and convenience.

/**
 * 按日期查询子账号统计汇总数据
 * @throws Exception
 */
@Test
public void testGetSubAccountAggregate() throws Exception {
    //公共参数,填写自己的实际参数
    String secretKey = super.secretKey;
    String userId = super.userId;
    String ptime = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/v2/sub-account/stats/agg/page";
    String startDate="2021-05-01";
    String endDate="2021-06-01";
    String email="xxx@polyv.net";
    String appId="xxxxxxxx";

    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("userId", userId);
    requestMap.put("ptime", ptime);
    requestMap.put("startDate", startDate);
    requestMap.put("endDate", endDate);
    requestMap.put("email", email);
    requestMap.put("appId", appId);
    requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));

    String response = HttpUtil.postFormBody(url, requestMap);
    log.debug("按日期查询子账号统计汇总数据,{}", response);
    //do somethings

}

Response Example

For global error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": {
        "pageNumber": 1,
        "totalPages": 1,
        "pageSize": 20,
        "contents": [
            {
                "email": null,
                "appId": "XXXXXXXXXX",
                "flowSize": 4370541,
                "view": 1,
                "duration": 12
            },
            {
                "email": "XXXXX@polyv.net",
                "appId": "XXXXXXXXXX",
                "flowSize": 66267275,
                "view": 3,
                "duration": 502
            }
        ],
        "totalItems": 2
    }
}

Error Example

{
    "code":400,
    "status":"error",
    "message":"sign can not be empty.",
    "data":""
}
联系客服,在线咨询