保利威文档中心

幫助中心

修改頻道微信分享資訊(新版)

更新時間:2025-07-04 13:49:58

舊版介面位址修改頻道微信分享資訊(舊版)

介面描述

1、修改频道微信分享信息,对应新版后台的 营销-分享设置
2、接口支持https协议

介面URL

http://api.polyv.net/live/v4/channel/share/update

線上API呼叫

請求方式

GET

介面限制

1、介面同時支援HTTP、HTTPS,建議使用HTTPS以確保介面安全,介面呼叫有頻率限制,詳細請查看

2、weixinShareCustomUrl、webShareCustomUrl需要進行URL編碼

請求參數說明

參數名 必填 類型 說明
appId true String 帳號appId【詳見取得金鑰
timestamp true Long 目前13位毫秒級時間戳記,3分鐘內有效
sign true String 簽名,為32位大寫的MD5值,產生簽名的appSecret金鑰作為通訊資料安全的關鍵資訊,嚴禁儲存在用戶端直接使用,所有API都必須透過客戶自己伺服器中轉呼叫POLYV伺服器取得回應資料【詳見簽名產生規則
channelId true String 頻道號
shareBtnEnable true String 是否開啟分享,Y:開啟,N:關閉
titleType true String 標題類型follow直播標題、custom自訂
weixinShareTitle false String 分享標題,最大長度50,標題類型為custom時,此欄位必填
weixinShareDesc false String 分享簡介,最大長度120,標題類型為custom時,此欄位必填
weixinShareCustomUrl false String 微信自訂分享位址,最大長度512,連結必須帶協定,如:https://,链接需要进行encode
webShareCustomUrl false String 網頁觀看自訂分享位址,最大長度512,連結必須帶協定,如:https://,链接需要进行encode
weixinShareCustomUrlWithParamEnabled false String 微信自訂分享位址攜帶分享者參數開關,Y:開啟,N:關閉,預設為N
webShareCustomUrlWithParamEnabled false String 網頁觀看自訂位址攜帶分享者參數開關,Y:開啟,N:關閉,預設為N

範例

http://api.polyv.net/live/v4/channel/share/update?shareBtnEnable=Y&titleType=custom&weixinShareDesc=%E4%BF%9D%E5%88%A9%E5%A8%81%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%88%86%E4%BA%AB%E6%8F%8F%E8%BF%B0&appId=frlr1zazn3&weixinShareTitle=%E4%BF%9D%E5%88%A9%E5%A8%81%E6%B5%8B%E8%AF%95%E5%BE%AE%E4%BF%A1%E5%88%86%E4%BA%AB%E6%A0%87%E9%A2%98&sign=F1EB80BAA9D52621CC9D90175BF75B0F&weixinShareCustomUrl=httPs%3A%2F%2Fpolyv.com&channelId=2567762&timestamp=1632818720193

回應參數說明

參數名 類型 說明
code Integer 回應狀態碼,200為成功返回,非200為失敗
status String 回應結果,由業務決定,成功返回success,失敗返回error
success Boolean 回應結果,由業務決定,成功返回true,失敗返回false
data Object 成功回應時返回null
error Object 狀態碼非200時的錯誤資訊【詳見Error欄位說明
requestId String 請求ID,每次請求產生的唯一UUID,僅可用於排查、除錯,不應與業務掛鉤

Error參數說明

參數名 類型 說明
code Integer 錯誤代碼,用於確定具體的錯誤原因
desc String 錯誤描述,與error.code對應

Java請求範例

快速接入基礎程式碼請下載相關依賴原始碼點擊下載原始碼,下載後加入自己的原始碼工程中即可。測試案例中的HttpUtil.java 和 LiveSignUtil.java 都包含在下載檔案中。

強烈建議您使用直播Java SDK完成API的功能對接,直播Java SDK對API呼叫邏輯、異常處理、資料簽名、HTTP請求執行緒池進行了統一封裝和最佳化。

    private static final Logger log = LoggerFactory.getLogger(ChannelShareTest.class);

    @Test
    public void testUpdateChannelShare() throws IOException, NoSuchAlgorithmException {
        String appId = super.appId;
        String appSecret = super.appSecret;
        String timestamp = String.valueOf(System.currentTimeMillis());
        //业务参数
        String url = "http://api.polyv.net/live/v4/channel/share/update";
        
        //http 调用逻辑
        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        requestMap.put("channelId", "2567762");
        requestMap.put("shareBtnEnable", "Y");
        requestMap.put("titleType", "custom");
        requestMap.put("weixinShareTitle", "保利威测试微信分享标题");
        requestMap.put("weixinShareDesc", "保利威测试微信分享描述");
        requestMap.put("weixinShareCustomUrl", "httPs://polyv.com");
        
        requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
        
        String response = HttpUtil.get(url,requestMap);
        
        log.info("测试设置频道分享设置,返回值:{}", response);
    }

回應範例

成功範例

{
    "code": 200,
    "status": "success",
    "requestId": "0be255f3-51e6-482d-bc27-82cab8b11607",
    "data": null,
    "success": true
}

異常範例

{
    "code": 400,
    "status": "error",
    "requestId": "560d3c9c4d2d4736948906cf3769feea.67.16360831361283559",
    "error": {
        "code": 10001,
        "desc": "分享开关不能为空"
    },
    "data": null,
    "success": false
}
联系客服,在线咨询