直播答题-获取套题ID下所有的题目信息

接口URL

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

接口说明

1、作用:获取频道套题下的所有题目信息
2、接口支持https协议

请求方式

GET

请求参数

参数名必选类型说明

appId

string

非业务参数,从API设置中获取,在直播系统登记的appid

sign

string

非业务参数,签名,32位大写MD5值

timestamp

string

当前时间毫秒级时间戳(13位,三分钟有效)

groupId

string

字符串

响应参数

参数名说明

status

响应状态

data

响应结果

code

http响应状态码

msg

异常错误信息

questionId

题目ID

groupId

套题ID

channelId

频道号

userId

用户ID

name

题目名称

type

题目类型:单选(R)

option1

选择项1

option2

选择项2

option3

选择项3

option4

选择项4

option5

选择项4

answer

答案:1 2 3 4 5

createdTime

创建时间

lastModified

最后修改时间

响应成功JSON示例

{
  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"	  
    }
  ]
}

响应异常JSON示例

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

PHP请求示例

<?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;
?>

签名规则:

​ 将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在首尾加上appSecret,生成32位大写MD5值,作为sign。 以下是示例过程:

1、请求参数为 ​ timestamp =1488277559000 ​ appId = "egzq0dunak" ​ groupId="jjksiiijjd"

2、将请求参数按照参数名字典顺序排列 ​ appId = "egzq0dunak" ​ groupId="jjksiiijjd" ​ timestamp =1488277559000

3、连接字符串 连接参数名与参数值,并在首尾加上appSecret(appSecret的值为9018067824634261bd5733c6131ce35f),如下: 9018067824634261bd5733c6131ce35fappIdegzq0dunakgroupIdjjksiiijjdtimestamp14882779750009018067824634261bd5733c6131ce35f

4、生成签名sign 7D3C7E4DF08A952A9949C51E0F426782

Last updated