Polyv Help Center

Help Center

Query User Information by Lesson Dimension

Updated: 2024-10-21 09:33:43

API Description

1、基于课节维度查询用户信息
2、接口支持https协议
3、这里的数据只是纯业务统计数据,与计费无关

API URL

http://api.polyv.net/hi-class-api/open/statistics/v1/list

Request Method

GET

API Constraints

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

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See Get Secret Key
timestamp true Long Current 13-digit millisecond timestamp, valid for 3 minutes
sign true String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must never 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 Signature Generation Rules
lessonId true Long Lesson ID
pageSize false Integer Page size, default 10
pageNumber false Integer Current page number, starting from 1

Example

http://api.polyv.net/hi-class-api/open/statistics/v1/list?appId=z2gw5icesv&sign=935F4C0CF3EB84A3EFB2BC691DB714A5&timestamp=1631780657591&lessonId=7594&pageNumber=1&pageSize=10

Response Parameter Description

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See Global Error Description
status String Response status text
error Error Error object See Global Error Description
data Object Relevant information on successful request See Data Parameter Description, empty on failure
Data Parameter Description
Parameter Type Description
pageSize Integer Number of items per page, default 10
pageNumber Integer Current page number
totalPages Integer Total number of pages
totalItems Integer Total number of items
contents Array Query result list See Contents Parameter Description
Contents Parameter Description
Parameter Type Description
viewerId String User ID
name String User nickname
startTime Date Entry time, format: yyyy-MM-dd HH:mm:ss
endTime Date Exit time, format: yyyy-MM-dd HH:mm:ss
joinDuration String Co-connection duration, format: HH:mm:ss
ip String IP address
userAgent String User device
operatingSystem String Operating system: Windows, Mac, Android, iOS, or others
browser String Browser, e.g., Chrome 93
country String Country
province String Province
city String City
isp String Internet Service Provider

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 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.

/**
 * 基于课节维度查询用户信息
 * @throws IOException
 */
@Test
public void testGetDocList() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId = this.appId;
    String appSecret = this.appSecret;
    String timestamp = String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/hi-class-api/open/statistics/v1/list";
    String lessonId = "7190";
    String pageNumber = "1";
    String pageSize = "5";

    //http 调用逻辑
    Map<String, String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp", timestamp);
    requestMap.put("lessonId", lessonId);
    requestMap.put("pageNumber", pageNumber);
    requestMap.put("pageSize", pageSize);
    requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
    String response = HttpUtil.get(url, requestMap);
    log.info("测试基于课节维度查询用户信息:{}", response);
}

Response Example

For global error descriptions, see Global Error Description

Success Example

{
    "code": 200,
    "status": "success",
    "data": {
        "pageNumber": 1,
        "pageSize": 2,
        "totalPages": 3,
        "totalItems": 5,
        "contents": [
            {
                "viewerId": "viewer_a",
                "nickname": "aaa",
                "startTime": "2021-10-01 11:11:01",
                "endTime": "2021-10-01 11:11:12",
                "joinDuration": "01:01:14",
                "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57",
                "operatingSystem": "windows",
                "browser": "chrome 94",
                "ip": "127.0.0.1",
                "isp": "电信",
                "country": "中国",
                "province": "广东",
                "city": "广州"
            },
            {
                "viewerId": "viewer_b",
                "nickname": "aaa_bbbb",
                "startTime": "2021-10-01 11:10:01",
                "endTime": "2021-10-01 11:10:12",
                "joinDuration": "01:01:14",
                "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57",
                "operatingSystem": "windows",
                "browser": "chrome 94",
                "ip": "127.0.0.1",
                "isp": "移动",
                "country": "中国",
                "province": "广东",
                "city": "广州"
            }
        ]
    },
    "success": true
}

Error Example

{
  "code": 400,
  "status": "error",
  "data": "",
  "error": {
    "code": xx,
    "desc": "错误描述"
  }
}
联系客服,在线咨询