保利威文档中心

幫助中心

取得使用者自訂微信分享介面設定

更新時間:2022-09-02 18:08:07

介面URL

https://api.polyv.net/live/v3/user/get-weixin-share-api

介面說明

設定使用者自訂的微信分享介面位址

支援格式

JSON

請求方式

GET

請求參數

參數名 必填 類型及範圍 說明
sign String 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則
appId true string 開發者帳號下的appId
timestamp true string 13位當前時間的時間戳

回傳錯誤結果JSON範例

未輸入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": ""
}

回傳正確結果JSON範例

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": "http://www.polyv.net/weixinshare/url"
}

回傳結果data表示成功修改的數量.

欄位說明

欄位 類型及範圍 說明
code int32 回傳碼
status string 回傳狀態
message string 回傳資訊
data string 回傳設定的微信分享呼叫介面位址

PHP請求範例

<?php

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

//接口需要的参数(非sign)赋值
$appId = "XXXXXXXX";
$timestamp = "123123123123";
$params = array(
        'appId'=>$appId,
        'timestamp'=>$timestamp
    );

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "https://api.polyv.net/live/v3/user/get-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;
?>
联系客服,在线咨询