Polyv Help Center

Help Center

Get the List of Answer Card Sending Records for Each Live Stream

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

Interface URL

https://api.polyv.net/live/v3/channel/question/list-interact-record

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 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 and obtain response data. For details, see Signature Generation Rules
channelId Yes string Channel ID
startTime No long Query start time timestamp, 13-digit milliseconds. If not provided, defaults to the last 7 days of data
endTime No long Query end time timestamp, 13-digit milliseconds. If not provided together with startTime, defaults to the last 7 days of data
sessionId No string Session ID to query
page No int Page number, defaults to 1
pageSize No int Number of records per page, defaults to 20

Successful Response JSON Example:

// 成功
{
  "code": 200,
  "status": "success",
  "message": null,
  "data": {
    "endRow": 8,
    "contents": [
      {
        "status": 11,
        "questionId": "asdfg12311",
        "sessionId": "zxcvbasdfg",
        "name": "今天天气怎么样",
        "createdTime": 1589007127629,
        "type": "R",
        "channelId": 100000,
        "userId": "poiu12wsde,
        "times": 1
      }
    ],
    "firstPage": true,
    "lastPage": false,
    "limit": 10,
    "nextPageNumber": 8,
    "offset": 10,
    "pageNumber": 10,
    "pageSize": 9,
    "prePageNumber": 10,
    "startRow": 5,
    "totalItems": 8,
    "totalPages": 3,
    "occaecate": 62485716
  }
}

Failed Response JSON Example:

Missing appId

{
    "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].questionId Question ID
data.contents[0].name Question name
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].userId User ID
data.contents[0].sessionId Live session ID
data.contents[0].times Number of times the question was sent
data.contents[0].status Sending status (11: Answering in progress, 12: Answering ended, 13: Sending answer results to students)
data.contents[0].createdTime Creation time

PHP Request Example

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

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

$url = "https://api.polyv.net/live/v3/channel/question/list-interact-record?".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;
?>
联系客服,在线咨询