Polyv Help Center

Help Center

Set Channel Callback URL

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

Interface URL

http://api.polyv.net/live/v3/user/set-channel-callback

Interface Description

1. Set the channel callback URL; used for notification callback URL configuration when channels are added, deleted, or modified (including basic information settings, lecturer settings, guest settings, and live stream status changes).
2. The interface supports HTTPS.

Request Method

POST

Request Parameters

Parameter Required Type and 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 saved or used directly on the client side. All APIs must be called through the customer's own server to relay request data to and from the POLYV server. For details, see Signature Generation Rules.
appId true string The appId under the developer account.
timestamp true string The current 13-digit timestamp.
url true string The callback URL, must include the protocol (http, https). Pass an empty string to disable the callback service. Must not exceed 255 characters.

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": ""
}
回调url不合法
{
    "code": 400,
    "status": "error",
    "message": "url is illegal",
    "data": ""
}

Example of Success Response JSON

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": "success"
}

Field Description

Field Type and 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 string

PHP Request Example

<?php

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

$url = "https://api.polyv.net/live/channelCallbackTest";
$params = array(
        'appId'=>$appId,
        'url'=>$url,
        '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, "POST");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;
?>
联系客服,在线咨询