获取多个频道号预约数与点赞数

接口URL

http://api.polyv.net/live/v3/channel/bookings-and-likes

接口说明

1.获取多个频道号预约数与点赞数
2.接口支持https

请求方式

GET

请求参数

参数名必选类型及范围说明

sign

true

String

签名,为32位大写的MD5值,生成签名的appSecret密钥作为通信数据安全的关键信息,严禁保存在客户端直接使用,所有API都必须通过客户自己服务器中转调用POLYV服务器获取响应数据【详见签名生成规则

appId

true

string

开发者账号下的appId

timestamp

true

string

13位当前时间的时间戳

channelIds

true

string

频道号。多个用英文逗号隔开

返回错误结果JSON示例

签名错误:
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
时间戳错误:
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}
appId错误
{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}
应用找不到
{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}
频道号错误
{
    "code": 400,
    "status": "error",
    "message": "channelIds is required.",
    "data": ""
}

返回正确结果JSON示例

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": [
        {
            "channelId": 2271296,
            "bookings": 1,
            "likes": 0
        },
        {
            "channelId": 2271286,
            "bookings": 0,
            "likes": 0
        },
        {
            "channelId": 2075015,
            "bookings": 0,
            "likes": 81
        }
    ]
}

字段说明

字段类型及范围说明

code

int

接口请求状态码,200表示成功

status

string

接口请求状态,"success"表示成功

message

string

请求失败时返回的错误信息

data

array

data[].channelId

int

频道号

data[].bookings

long

预约数

data[].likes

long

点赞数

PHP请求示例

<?php

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

$channelIds = "322120,2029098";
$params = array(
        'appId'=>$appId,
        'channelIds'=>$channelIds,
        'timestamp'=>$timestamp
    );

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

$url="http://api.polyv.net/live/v3/channel/bookings-and-likes?".http_build_query($params);

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

Last updated