Polyv Help Center

Help Center

Get Multi-Channel Scheduled Lottery Status API

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

API URL

http://api.polyv.net/live/v3/channel/lottery/get-rooms-status

API Description

1. Get the scheduled lottery status for multiple channels
2. API supports HTTPS

Request Method

GET

Request Parameters

Parameter Required Type & Range Description
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 not be stored or used directly on the client side. All API calls must be relayed through the customer's own server to the POLYV server to obtain response data. For details, see Signature Generation Rules
appId true string The appId under the developer account
timestamp true string 13-digit current Unix timestamp
channelIds true string Channel IDs. Separate multiple IDs with commas

Error Response JSON Example

签名错误:
{
    "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": ""
}

Success Response JSON Example

{
    "code":200,
    "status":"success",
    "message":"",
    "data":[
        {
            "roomId":"2437051",
            "status":3,
            "time":0
        },
        {
            "roomId":"2442336",
            "status":3,
            "time":0
        }
    ]
}

Field Description

Field Type & Range Description
code int API request status code, 200 indicates success
status string API request status, "success" indicates success
message string Error message returned when the request fails
data array
data[].roomId string Channel ID
data[].status int Lottery status: 0 countdown, 1 drawing, 2 ended, 3 closed
data[].time int Remaining scheduled time, in milliseconds

PHP Request Example

<?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;
?>
联系客服,在线咨询