获取频道或全局登记观看字段

接口URL

https://api.polyv.net/live/v3/channel/auth/get-record-field

接口说明

1、接口用于获取频道或全局的登记观看字段
2、接口支持https

支持格式

JSON

请求方式

GET

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 13位当前时间戳
sign string 签名值
rank int 主要观看条件为1,次要观看条件为2
channelId int 频道号,不填为获取全局

响应成功JSON示例:

{
  "code": 200, 
  "status": "success", 
  "message": "", 
  "data": [
    {
      "type": "name", 
      "name": "姓名", 
      "options": null, 
      "placeholder": "请输入姓名"
    }, 
    {
      "type": "mobile", 
      "name": "手机号码", 
      "options": null, 
      "placeholder": "请输入手机号码"
    }, 
    {
      "type": "number", 
      "name": "数字", 
      "options": null, 
      "placeholder": "请输入数字"
    }, 
    {
      "type": "option", 
      "name": "性别", 
      "options": "男,女", 
      "placeholder": "请选择性别"
    }
  ]
}

响应失败JSON示例:

未输入appId

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

appId不正确

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

时间戳错误

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

签名错误

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

channelId为空

{
  "code": 400, 
  "status": "error", 
  "message": "param should not be empty: channelId", 
  "data": ""
}

频道不存在

{
  "code": 404, 
  "status": "error", 
  "message": "channel not found.", 
  "data": ""
}

频道非法

{
  "code": 403, 
  "status": "error", 
  "message": "illegal channel id: 206240", 
  "data": ""
}

字段说明

参数名 说明
code 响应代码,成功为200,失败为400,签名错误为401,异常错误500
status 成功为success,失败为error
message 错误时为错误提示消息
data 登记观看的字段信息
type 登记观看类型。name-姓名;mobile-手机号码;number-数字;option-下拉选择;text-文本
name 登记观看信息标题
placeholder 登记观看信息描述
options 登记观看为下拉选择时的选项,选项值以英文逗号分隔

php请求示例

<?php
//引用config.php
include 'config.php';

$channelId="206204";
$rank = "1";

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'rank' => $rank
);

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

$url = "http://api.polyv.net/live/v3/channel/auth/get-record-field?".http_build_query($params);

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

echo $res;
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...