Add Application Interface
Updated: 2022-09-02 18:08:07
Interface URL
https://api.polyv.net/live/v2/app/add
Interface Description
1、接口用于创建应用
2、接口支持https
Supported Format
JSON
Request Method
POST
Request Limit
TRUE
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | Yes | string | Admin's APPID |
| timestamp | Yes | long | 13-digit current timestamp |
| sign | Yes | String | Signature, a 32-character uppercase MD5 value. The appSecret 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 and obtain response data. See Signature Generation Rules |
| name | Yes | string | Application name |
| watchDomain | No | string | Custom watch page domain |
| webappDomain | No | string | Custom admin backend domain |
| logoImg | No | string | Custom admin backend icon URL |
| coverImg | No | string | Custom admin backend cover image URL |
| concurrences | No | int | Application concurrency limit |
| webinarEnabled | No | string | Enable webinar toggle, Y to enable, N to disable, default is N |
| appEnglishName | No | string | Application English name |
Successful Response JSON Example:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"appId": "fbj0k74n6s",
"name": "test-ccb-3",
"appSecret": "9a9c4badcecd42dc82131f229d07fd04",
"userId": "a6580a9674",
"appEnglishName": "testEnglish"
}
}
Failed Response JSON Examples:
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 | Response code, 200 for success, 400 for failure, 401 for signature error, 500 for exception error |
| status | success for success, error for failure |
| message | Error message when failed |
| data | Related application information on successful response |
| data.appId | The appId used to call POLYV for this application |
| data.appSecret | The appSecret used to call POLYV for this application |
| data.name | Application name |
| data.userId | Application ID, corresponding to POLYV user ID |
| data.appEnglishName | Application English name |
PHP Request Example
<?php
//引用config.php
include '/srv/http/config.php';
$params = array(
'appId' => $appId,
'name' => $name,
'watchDomain' => $watchDomain,
'webappDomain' => $webappDomain,
'logoImg' => $logoImg,
'coverImg' => $coverImg,
'concurrences' => $concurrences,
'timestamp' => $timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "https://api.polyv.net/live/v2/app/add?".http_build_query($params);
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, $url);
$res = curl_exec($curl);
curl_close($curl);
echo $res;
?>
