Polyv Help Center

Help Center

Get Summary Information for Videos Under a Category

Updated: 2022-05-23 19:02:59

Interface URL

http://api.polyv.net/v2/cata/total-stats

Interface Description

Retrieves summary information for videos under a category. Data has a 10-minute delay.

Supported Format

JSON

Request Method

GET

Request Limit

TRUE

Request Parameters

Parameter Required Type & Scope Description
userid true string User ID
cataid false long Category ID, e.g., 1 for the default category. If not provided, queries summary information for the entire user.
containSubCata false boolean Whether to include subcategories. true: include, false: exclude.
ptime true long Current 13-digit millisecond timestamp, valid for 3 minutes.
sign true String Signature, a 40-character uppercase SHA1 value. See signature generation rules

JSON Example

{
    "code": 200,
    "status": "success",
    "message": "success",
    "data": {
        "videoNum": 28,
        "usedSpace": 673027885
    }
}

Return Error JSON

签名不正确
{
"code":400,
"status":"error",
"message":"the sign is not right",
"data":""
}
时间戳过期
{
"code":400,
"status":"error",
"message":"ptime is too old.",
"data":""
}
不合法的分类ID
{
"code":400,
"status":"error",
"message":"illegal cataid",
"data":""
}

Field Description

Field Description
code Request return status code
status Request return status
message Request return message
data Return data
videoNum int, total number of videos under the category
usedSpace long, total space occupied by videos under the category, in bytes

Java Request Example

@Test
    public void testGetCataTotalStats() throws Exception {
        String url = "http://api.polyv.net/v2/cata/total-stats";
        String userid = "xxxxxxxxxx";
        long cataid = 1L;
        String secretkey = "xxxxxxxxxx";
        Map<String, String> params = new HashMap<>();
        params.put("userid", userid);
        params.put("cataid", String.valueOf(cataid));
        params.put("containSubCata", String.valueOf(true));
        params.put("ptime", String.valueOf(System.currentTimeMillis()));
        params.put("sign", getSign(params, secretkey));
        String response = HttpClientUtil.getInstance().sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
        System.out.println(response);
    }
联系客服,在线咨询