自訂註冊使用者介面
更新時間:2022-09-02 18:08:07
介面URL
http://api.polyv.net/live/v2/app/add-custom-user
介面說明
1、接口用于注册用户
2、接口支持https
支援格式
JSON
請求方式
POST
請求數限制
TRUE
請求參數
| 參數名 | 必選 | 類型 | 說明 |
|---|---|---|---|
| appId | 是 | string | 呼叫介面所需的APPID |
| timestamp | 是 | long | 13位當前時間戳 |
| sign | 是 | String | 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在客戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器獲取回應資料【詳見簽名產生規則】 |
| saleId | 否 | int | 銷售ID |
| 是 | string | 電子郵件地址 | |
| mobile | 是 | string | 手機號碼 |
| passwd | 是 | string | 登入密碼,長度限制:5到16位 |
| industry | 否 | string | 企業名稱 |
回應成功JSON範例:
{
"code": 200,
"status": "success",
"message": "",
"data": {
"appId": "$appId",
"name": "$name",
"appSecret": "$appSecret",
"userId": "$userId"
}
}
回應欄位說明
| 參數名 | 說明 |
|---|---|
| code | 狀態碼,成功為200,簽名失敗為403,參數錯誤為400,伺服器端錯誤為500 |
| status | 成功為success,錯誤時為error |
| message | 成功為"",錯誤時為錯誤描述資訊 |
| data.appId | 使用者呼叫介面所需的appId |
| data.name | 使用者名稱 |
| data.appSecret | 使用者呼叫介面的KEY |
| data.userId | 使用者ID |
回應失敗JSON範例:
參數錯誤
{
"code": 400,
"status": "error",
"message": "param validate error",
"data": 400
}
未輸入appId
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
appId不正確
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
時間戳錯誤
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
簽名錯誤
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
php請求範例
<?php
//引用config.php
include 'config.php';
$email = "xxxxx@xxxx.com";
$passwd = "123456";
$name = "xxxxx";
$mobile = "1889887777";
$industry="company";
$saleId = "$saleId";
$params = array(
'appId' => $appId,
'timestamp' => $timestamp,
'email' => $email,
'name' => $name,
'mobile' => $mobile,
'passwd' => $passwd,
'industry' => $industry,
'saleId' => $saleId
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "http://api.polyv.net/live/v2/app/add-custom-user?".http_build_query($params);
$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
$res = curl_exec($curl);
curl_close($curl);
echo $res;
?>
