Modify Channel Official Account Follow Settings
Interface Description
1、更新关注公众号设置接口
2、支持多个频道查询
3、接口支持https协议
Interface URL
http://api.polyv.net/live/v3/channel/promotion/update-channels-follow
Request Method
POST
Interface Constraints
The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details
The content-type of the qrCodeUrl image only supports "image/jpeg" or "image/png". Other types will throw an "img url error:request file content-type" exception.
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId [See Get Secret Key] |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid within 3 minutes |
| sign | true | 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 relayed through the customer's own server to call the POLYV server for response data. [See Signature Generation Rules] |
| channelIds | true | String | Channel IDs, multiple channels separated by "," |
| qrCodeUrl | true | String | Image link URL |
| enabled | false | String | Official account follow feature toggle. Leave empty to not modify. Y: Enable N: Disable |
| autoShowEnabled | false | String | Auto popup toggle. Leave empty to not modify. Y: Enable N: Disable |
| entranceText | false | String | Entrance text, maximum 8 characters. Leave empty to not modify. |
| tips | false | String | Popup prompt text, maximum 30 characters. Leave empty to not modify. |
| pcFollowTips | false | String | PC popup text, maximum 30 characters. |
Example
http://api.polyv.net/live/v3/channel/promotion/update-channels-follow
Form Parameters:
appId=fso8gzbxlr×tamp=1628069484000&channelIds=2452644,2446799&enabled=N&entranceText=welcome&tips=tips&autoShowEnabled=N&qrCodeUrl=http://image.biaobaiju.com/uploads/20181223/20/1545567880-shRzoBCgMS.jpeg&sign=9FC1777C16282BF180AF6CCF12E5437B
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure [See Global Error Description] |
| status | String | Response status text |
| message | String | Response description, provides error details when code is 400 or 500 |
| data | String | Returns null on success, empty string on failure |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. HttpUtil.java and LiveSignUtil.java in the test case are included in the download file.
It is strongly recommended to use the Live Java SDK for API functionality integration. The Live Java SDK provides unified encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 修改回调设置
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testUpdateSetting() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际
String appId = super.appId;
String appSecret = super.appSecret;
String userId = super.userId;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url="https://api.polyv.net/live/v3/channel/promotion/update-channels-follow";
String channelIds="2452644,2446799";
String enabled = "Y";
String autoShowEnabled = "Y";
String entranceText = "welcome";
String tips = "tips";
String qrCodeUrl = "http://image.biaobaiju.com/uploads/20181223/20/1545567880-shRzoBCgMS.jpeg";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelIds", channelIds);
requestMap.put("qrCodeUrl", qrCodeUrl);
requestMap.put("enabled", enabled);
requestMap.put("autoShowEnabled", autoShowEnabled);
requestMap.put("entranceText", entranceText);
requestMap.put("tips", tips);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(url, requestMap);
log.info("修改关注公众号设置,返回值:{}", response);
//do somethings
}
Response Example
For system-wide global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"message": "",
"data": "SUCCESS"
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
