Modify Channel Likes and View Count
Interface Description
1、设置频道的点赞数和观看热度
2、接口URL中的{channelId}为频道号
3、接口支持https协议
Interface URL
http://api.polyv.net/live/v2/channels/{channelId}/update-likes
Request Method
GET
Interface Constraints
The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details
The request parameters
likesandviewerscan be passed together or individually, but at least one must be provided.
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details for obtaining 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 called through the customer's own server to relay requests to the POLYV server for response data. See signature generation rules |
| likes | false | Integer | Number of likes |
| viewers | false | Integer | Viewing popularity (corresponds to view count) |
Example
http://api.polyv.net/live/v2/channels/1965681/update-likes?viewers=1000000&appId=frlr1zazn3&sign=1898800445FDCD9206ABE1AB504C2C52×tamp=1621840658326&likes=99999
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code. 200 indicates success, non-200 indicates failure See global error description |
| status | String | Response status text |
| message | String | Response description. When code is 400 or 500, provides additional error details |
| data | String | Returns "success" on success, empty on error |
Java Request Example
For quick integration of the base code, please download the relevant dependency source code. Click here to download the source code. After downloading, add it to your own source project. The test cases include HttpUtil.java and LiveSignUtil.java, both contained in the download file.
It is strongly recommended to use the Live Java SDK for API 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(WebInfoTest.class);
/**
* 修改频道点赞数和观看次数
* @throws IOException
*/
@Test
public void testUpdateLikes() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId=super.appId;
String appSecret=super.appSecret;
String userId = super.userId;
String timestamp=String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/live/v2/channels/%s/update-likes","1965681");
String likes = "99999";
String viewers = "1000000";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("likes",likes);
requestMap.put("viewers",viewers);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url,requestMap);
log.info("测试修改频道点赞数和观看次数:{}",response);
//do somethings
}
Response Example
For global system 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": ""
}
