Set User WeChat Share Custom URL Interface
Updated: 2022-09-02 18:08:07
Interface URL
https://api.polyv.net/live/v3/user/set-weixin-share-api
Interface Description
Set the user-defined WeChat share interface URL
Supported Format
JSON
Request Method
POST
Request Parameters
| Parameter | Required | Type & Scope | Description |
|---|---|---|---|
| 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 to obtain response data. For details, see Signature Generation Rules |
| appId | true | string | The appId under the developer account |
| timestamp | true | string | 13-digit current timestamp |
| url | true | string | Interface URL |
Error Response JSON Example
appId not provided
{
"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": ""
}
Success Response JSON Example
{
"code": 200,
"status": "success",
"message": "",
"data": "success"
}
The returned data indicates the number of successfully modified records.
Field Description
| Field | Type & Scope | Description |
|---|---|---|
| code | int32 | Return code |
| status | string | Return status |
| message | string | Return message |
| data | string | Operation result |
PHP Request Example
<?php
//引用config.php
include 'config.php';
//接口需要的参数(非sign)赋值
$appId = "XXXXXXXX";
$timestamp = "123123123123";
$url = "http://www.polyv.ne/xxx";
$params = array(
'appId'=>$appId,
'url'=>$url,
'timestamp'=>$timestamp
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;
$url = "https://api.polyv.net/live/v3/user/set-weixin-share-api?".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;
?>
