Polyv Help Center

Help Center

Paginated List of Quiz Participants

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

Interface URL

https://api.polyv.net/live/v3/channel/question/answer-record/list-by-page

Interface Description

1、接口用于分页获取某次答题的答题观众列表
2、接口支持https

Request Method

GET

Request Parameters

Parameter Required Type Description
appId Yes string Obtained from API settings, the appId registered in the live streaming system
timestamp Yes long Current 13-digit millisecond timestamp, valid for 3 minutes
sign Yes String Signature, a 32-character uppercase MD5 value. The appSecret key used to generate the signature is critical for communication data security. It must not be stored 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 to obtain response data. See Signature Generation Rules
channelId Yes string Channel ID
questionId Yes string Question ID, obtained from the question list
times Yes int The quiz attempt number, used when the same question is sent multiple times, obtained from the question list
page No int Page number, default is 1
pageSize No int Number of items per page, default is 20

Successful Response JSON Example:

// 成功
{
  "code": 200,
  "status": "success",
  "message": null,
  "data": {
    "endRow": 2,
    "contents": [
      {
        "questionId": "text",
        "costTime": 60,
        "viewerId": "",
        "submitTime": 6,
        "nickname": "",
        "submitTimeFormat": "text",
        "channelId": 3,
        "times": 1,
        "answer": "",
        "sessionId": "text",
        "costTimeFormat": "",
        "viewerAnswer": "",
        "type": "",
        "correct": "N",
        "name": ""
      }
    "firstPage": false,
    "lastPage": true,
    "limit": 0,
    "nextPageNumber": 0,
    "offset": 7,
    "pageNumber": 1,
    "pageSize": 0,
    "prePageNumber": 7,
    "startRow": 4,
    "totalItems": 0,
    "totalPages": 9,
    "nulla5af": 58983375
  }
}

Failed Response JSON Examples:

No appId provided

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

Incorrect appId

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

Timestamp error

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

Signature error

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

Field Description

Parameter Description
code Response status code, e.g., 200
status Response status
message Error message
data Response result set
data.pageNumber Page number
data.limit Records per page
data.totalItems Total number of records
data.firstPage Whether it is the first page, value: true/false
data.lastPage Whether it is the last page, value: true/false
data.nextPageNumber Next page number
data.prePageNumber Previous page number
data.totalPages Total number of pages
data.startRow Position of the first record on the current page in the list
data.endRow Position of the last record on the current page in the list
data.contents[0].viewerId Viewer ID
data.contents[0].nickname Viewer nickname
data.contents[0].type Question type ("R": Single choice, "C": Multiple choice, "S": Rating, "Q": Q&A, "V": Voting)
data.contents[0].channelId Channel ID
data.contents[0].questionId Question ID
data.contents[0].name Question text
data.contents[0].answer Correct answer
data.contents[0].correct Whether correct, Y: Correct, N: Incorrect
data.contents[0].viewerAnswer Viewer's answer
data.contents[0].sessionId Live session ID
data.contents[0].times Distinguishes different attempts for the same question
data.contents[0].submitTime Submission time, timestamp
data.contents[0].submitTimeFormat Formatted submission time, format: yyyy/MM/dd HH:mm:ss
data.contents[0].costTime Time spent answering, in seconds
data.contents[0].costTimeFormat Formatted time spent answering

PHP Request Example

<?php
//引用config.php
include 'config.php';
$params = array(
    'appId' => $appId,
    'timestamp' => $timestamp,
    'channelId' => 108888,
    'questionId' => "zxcvbnm",
    'times' => 1
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "https://api.polyv.net/live/v3/channel/question/answer-record/list-by-page?".http_build_query($params);

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>
联系客服,在线咨询