Polyv Help Center

Help Center

Live Quiz - Retrieve All Questions Under a Question Set ID

Updated: 2022-05-16 10:08:41

Interface URL

http://api.polyv.net/live/v2/channels/{channelId}/qa-questions
(注:{channelId}为频道号)

Interface Description

  1. Purpose: Retrieve all question information under a channel's question set.
  2. The interface supports the HTTPS protocol.

Request Method

GET

Request Parameters

Parameter Required Type Description
appId Yes string Non-business parameter. Obtained from API settings, the appId registered in the live system.
sign Yes string Non-business parameter. Signature, 32-character uppercase MD5 value.
timestamp Yes string Current time in milliseconds (13 digits, valid for 3 minutes).
groupId Yes string String.

Response Parameters

Parameter Description
status Response status.
data Response data.
code HTTP response status code.
msg Error message.
questionId Question ID.
groupId Question set ID.
channelId Channel ID.
userId User ID.
name Question name.
type Question type: Single choice (R).
option1 Option 1.
option2 Option 2.
option3 Option 3.
option4 Option 4.
option5 Option 5.
answer Answer: 1 2 3 4 5.
createdTime Creation time.
lastModified Last modification time.

Successful Response JSON Example

{
  code: 200,
  status: "success",
  message: "",
  data: [
      {
      questionId: "i6ro0hxj00",
      groupId: "i6ro0hxj00",	  
      channelId: 10001,
      userId: "i6ro0hxj00",
      name: "题目1",
      type: "R",
      option1: "选择项1",
      option2: "选择项2",
      option3: "选择项3",
      option4: "选择项4",
      option5: "选择项5",	  
      answer: "1",
      createdTime: "2018-01-22 00:00:00",
      lastModified: "2018-01-22 00:00:00"	  
    },
      {
      questionId: "i6ro0hxj00",
      groupId: "i6ro0hxj00",	  
      channelId: 10001,
      userId: "i6ro0hxj00",
      name: "题目1",
      type: "R",
      option1: "选择项1",
      option2: "选择项2",
      option3: "选择项3",
      option4: "选择项4",
      option5: "选择项5",	  
      answer: "1",
      createdTime: "2018-01-22 00:00:00",
      lastModified: "2018-01-22 00:00:00"	  
    }
  ]
}

Error Response JSON Example

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

PHP Request Example

<?php
  $channelId="89001";
  $groupId="1kdjihdhj";
  $appId="egzq0dunak";
  $appSecret="9018067824634261bd5733c6131ce35f";
  $timestamp = time()*1000;
  $str = $appSecret."appId".$appId."groupId$groupId".timestamp".$timestamp.$appSecret;
  $sign=strtoupper(md5($str));

  $url="http://api.polyv.net/live/v2/channels/$channelId/qa-questions?appId=".$appId."&timestamp=".$timestamp."&sign=".$sign."&groupId=".groupId;

  $ch = curl_init() or die ( curl_error() );
  curl_setopt( $ch, CURLOPT_URL, $url);
  curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
  curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
  $response = curl_exec ( $ch );
  curl_close ( $ch );
  echo $response;
?>

Signature Rules:

Arrange non-empty request parameters in dictionary order by parameter name. Concatenate the parameter name and value. Prepend and append the appSecret to the string. Generate a 32-character uppercase MD5 value as the sign. The following is an example process:

1. Request parameters are: timestamp = 1488277559000 appId = "egzq0dunak" groupId = "jjksiiijjd"

2. Arrange request parameters in dictionary order by parameter name: appId = "egzq0dunak" groupId = "jjksiiijjd" timestamp = 1488277559000

3. Concatenate the string: Concatenate the parameter name and value. Prepend and append the appSecret (the value of appSecret is 9018067824634261bd5733c6131ce35f), as follows: 9018067824634261bd5733c6131ce35fappIdegzq0dunakgroupIdjjksiiijjdtimestamp14882779750009018067824634261bd5733c6131ce35f

4. Generate the signature sign: 7D3C7E4DF08A952A9949C51E0F426782

联系客服,在线咨询