Polyv Help Center

Help Center

Query Channel Quiz Card Results

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

API Description

1、通过频道号,查询答题卡答题结果列表
2、接口支持https协议
3、参数场次号、查询时间同时存在多个时,按参数优先级从小到大,选其中一个参数作为查询条件

API URL

http://api.polyv.net/live/v3/channel/question/answer-records

Online API Call

Request Method

GET

API Constraints

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

Request Parameters

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
channelId true String Channel ID
sessionId false String Session ID, priority 1
startDate false String Query start time, priority 2, format: yyyy-MM-dd, defaults to the last 7 days
endDate false String Query end time, priority 2, format: yyyy-MM-dd, defaults to the last 7 days

Example

http://api.polyv.net/live/v3/channel/question/answer-records?endDate=&appId=frlr1zazn3&sign=D0163266BDD894AC11D310082B84F75C&channelId=2191569&startDate=&timestamp=1621845243688

Response Parameters

Parameter Type Description
code Integer Response status code, 200 for success, non-200 for failure See Global Error Description
status String Response status text
message String Response description, provides error details when code is 400 or 500
data Array List of quiz card results See data field description

data Field Description

Parameter Type Description
questionId String Question ID
answer String Answer to the question
questionTitle String Question text
times Integer Number of times the question was sent, used to distinguish repeated sends of the same question
sendTime Long Quiz card send time, timestamp
endTime Long Quiz card close time, timestamp
total Integer Number of respondents
correctCount Integer Number of correct answers
interactStatus String Live session interaction operation status
timestamp Long Server time
rightUser String[] List of users who answered correctly
faultUser String[] List of users who answered incorrectly
type String Question type
R: Single choice
C: Multiple choice
V: Poll
S: Rating
itemType Integer Quiz type
1: Q&A
0: Quiz card
options Array List of question options See option field description
records Array List of users who answered See record field description

option Field Description

Parameter Type Description
title String Option title
count Integer Number of users who selected this option
percent String Percentage of users who selected this option

record Field Description

Parameter Type Description
viewerId String User ID of the respondent
nickname String Nickname of the respondent
answer String Answer submitted by the respondent
avatar String Avatar of the respondent
correct Boolean Whether the answer submitted by the respondent is correct
false: Incorrect
true: Correct
submitTime Long Submission time of the respondent, 13-digit millisecond timestamp
param4 String Custom user field
param5 String Custom user field

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 code 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 packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.

private static final Logger log = LoggerFactory.getLogger(InteractionQuestionTest.class);
/**
 * 查询频道答题卡结果
 * @throws IOException
 */
@Test
public void testGetAnswerList() throws IOException, NoSuchAlgorithmException {
        //公共参数,填写自己的实际参数
        String appId = super.appId;
        String appSecret = super.appSecret;
        String timestamp = String.valueOf(System.currentTimeMillis());

        //业务参数
        String url = "https://api.polyv.net/live/v3/channel/question/answer-records";
        String channelId = "2191569";
        String startDate = "";
        String endDate = "";

        //http 调用逻辑
        Map<String,String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp",timestamp);
        requestMap.put("channelId",channelId);
        requestMap.put("startDate",startDate);
        requestMap.put("endDate",endDate);
        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",
  "message": "",
  "data": [
    {
      "questionId": "fwly4r487r",
      "answer": "AB",
      "questionTitle": "快速问答",
      "times": 1,
      "sendTime": 1637308945000,
      "endTime": 1637308954000,
      "total": 2,
      "correctCount": 0,
      "interactStatus": null,
      "options": [
        {
          "title": "A",
          "count": 1,
          "percent": "50.00%"
        },
        {
          "title": "B",
          "count": 1,
          "percent": "50.00%"
        }
      ],
      "records": [
        {
          "viewerId": "ovtl9t_RxnrTdqkXqkT5Q5lnxp2A",
          "nickname": "卉",
          "answer": "B",
          "avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/3lMXVJoLMLJibnkFuA23lyqj5MOQufhW5ATvHuB8byssutficHKU0u7OMx5OQgg9WNVuHf44AXfbAMMAZejuYFTg/132",
          "correct": false,
          "submitTime": 1615394824000
        },
        {
          "viewerId": "1615394262720",
          "nickname": "周鑫",
          "answer": "A",
          "avatar": "https://liveimages.videocc.net/defaultImg/avatar/viewer.png",
          "correct": false,
          "submitTime": 1615394833000
        }
      ],
      "timestamp": null,
      "rightUser": [ ],
      "faultUser": [ ],
      "type": "R",
      "itemType": 1
    },
    {
      "questionId": "fwlx0ahwe9",
      "answer": "AB",
      "questionTitle": "快速问答",
      "times": 1, 
      "sendTime": 1637308945000,
      "endTime": 1637308954000,
      "total": 3,
      "correctCount": 0,
      "interactStatus": null,
      "options": [
        {
          "title": "A",
          "count": 1,
          "percent": "33.00%"
        },
        {
          "title": "B",
          "count": 2,
          "percent": "67.00%"
        }
      ],
      "records": [
        {
          "viewerId": "1615394262720",
          "nickname": "上海观众/10812",
          "answer": "A",
          "avatar": "https://liveimages.videocc.net/defaultImg/avatar/viewer.png",
          "correct": false,
          "submitTime": 1615394304000
        },
        {
          "viewerId": "ovtl9tyK6dqob_cgewjRnQ1tSB4U",
          "nickname": "周鑫",
          "answer": "B",
          "avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83epTUL7QR3hCkMDQOrBk7vcxZibiahB9SnPk6oUiadmZyOCxIOQiciajE4U2Xf78kpLnicCbzAnr1aMUWotA/132",
          "correct": false,
          "submitTime": 1615392378000
        },
        {
          "viewerId": "ovtl9t_RxnrTdqkXqkT5Q5lnxp2A",
          "nickname": "卉",
          "answer": "B",
          "avatar": "https://thirdwx.qlogo.cn/mmopen/vi_32/3lMXVJoLMLJibnkFuA23lyqj5MOQufhW5ATvHuB8byssutficHKU0u7OMx5OQgg9WNVuHf44AXfbAMMAZejuYFTg/132",
          "correct": false,
          "submitTime": 1615392461000
        }
      ],
      "timestamp": null,
      "rightUser": [ ],
      "faultUser": [ ],
      "type": "R",
      "itemType": 1
    }
  ]
}

Error Example

{
  "code": 400,
  "status": "error",
  "message": "invalid signature.",
  "data": ""
}
联系客服,在线咨询