文章目录
接口URL
http://api.polyv.net/live/v3/channel/weixin-share/update
接口说明
(接口调用有频率限制,详细请查看)
1、接口用于修改频道的微信分享相关设置
2、接口支持https
返回结果支持格式
JSON
请求方式
POST
请求数限制
TRUE
请求参数
参数名 | 必选 | 类型 | 说明 |
---|---|---|---|
appId | 是 | string | 从API设置中获取,在直播系统登记的appId |
timestamp | 是 | long | 13位当前时间戳 |
sign | 是 | string | 签名值 |
channelId | 是 | int | 频道号 |
weixinShareTitle | 否 | string | 微信分享的标题(30字符内) |
weixinShareDesc | 否 | string | 微信分享的描述(120字符内) |
响应成功JSON示例:
{
"code": 200,
"status": "success",
"message": "",
"data": "success"
}
响应失败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": ""
}
频道Id格式错误
{
"code": 400,
"status": "error",
"message": "param is not digit: %s",
"data": ""
}
频道不存在
{
"code": 404,
"status": "error",
"message": "channel not found.",
"data": ""
}
频道Id非法错误
{
"code": 400,
"status": "error",
"message": "illegal channel id: %s",
"data": ""
}
字段说明
参数名 | 说明 |
---|---|
code | 状态码,成功为200,签名失败为403,参数错误为400,服务端错误为500 |
status | 成功为success,错误时为error |
message | 成功为"",错误时为错误描述信息 |
data | 成功时success,错误时为"" |
php请求示例
<?php
//引用config.php
include 'config.php';
$params = array(
'appId' => "填写获取到的appId",
'timestamp' => "填写13位时间戳",
'channelId' => "填写频道号",
'weixinShareTitle' => "我要改标题",
'weixinShareDesc' => "我要改描述"
);
//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$url="http://api.polyv.net/live/v3/channel/weixin-share/update";
function post($url, $post_data = '', $timeout = 5){
$ch = curl_init();
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_POST, 1);
if($post_data != ''){
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
}
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_HEADER, false);
$file_contents = curl_exec($ch);
curl_close($ch);
return $file_contents;
}
$params["sign"] = $sign;
echo post($url, $params);
?>