Set Single Sign-On Token
Updated: 2023-11-14 14:07:19
Interface URL
https://api.polyv.net/live/v2/channels/{channelId}/set-token
Interface Description
1. Set the single sign-on token for the channel.
2. The interface supports HTTPS protocol.
3. The {channelId} in the interface URL is the channel ID.
Supported Format
JSON
Request Method
GET, POST
Request Limit
TRUE
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | Yes | string | Obtained from API settings, the appId registered in the live streaming system. |
| timestamp | Yes | string | Current 13-digit millisecond timestamp, valid for 3 minutes. |
| token | Yes | string | Unique string. |
| sign | Yes | 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 APIs must be called through the customer's own server to relay requests to the POLYV server for response data. For details, see Signature Generation Rules. |
Successful Response JSON Example:
{
"code": 200,
"status": "success",
"message": "",
"data": "success"
}
Failed Response JSON Example:
No appId entered
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
Incorrect appId
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
Timestamp error
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
Signature error
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Field Description
| Parameter | Description |
|---|---|
| code | Request status response code. |
| status | Request status. |
| message | Error message. |
| data | Returns "success" on success. |
PHP Request Example
<?php
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$channelId = "127075";
$token = "skudjjdkkkkk";
$params = array(
'appId'=>$appId,
'token'=>$token,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
//接口请求url
$url = "https://api.polyv.net/live/v2/channels/$channelId/set-token?appId=$appId×tamp=$timestamp&token=$token&sign=$sign";
//输出接口请求结果
echo file_get_contents($url);
?>
