Polyv Help Center

Help Center

Query Stream Name by Channel ID

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

Interface URL

http://api.polyv.net/live/v3/channel/get-channel-stream

Interface Description

1. Query stream name by channel ID (supports querying multiple channel IDs at once, separated by commas)
2. Interface supports HTTPS

Request Method

GET

Request Parameters

Parameter Required Type & Scope 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 never be stored or used directly on the client side. All API calls must be relayed through your own server to the POLYV server for response data. For details, see Signature Generation Rules
appId true string appId under the developer account
timestamp true string 13-digit current timestamp
channelIds true string Channel IDs. Multiple IDs should be separated by English commas

Example of Error Response (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": ""
}

Example of Successful Response (JSON)

{
    "code":200,
    "status":"success",
    "message":"",
    "data":[
        "xxxxxxdddd",
        "xdffdfdfdfd"
    ]
}

Field Description

Field Type & Scope Description
code int Interface request status code, 200 indicates success
status string Interface request status, "success" indicates success
message string Error message returned when the request fails
data array Array of stream names corresponding to the channel IDs

PHP Request Example

<?php

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

$streams = "13999,293333";
$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/get-channel-stream".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;
?>
联系客服,在线咨询