Channel Watch Page: Viewer Logout
Updated: 2025-11-20 10:17:25
Interface Description
1、频道观看页观众退出登录
2、接口支持https协议
Interface URL
http://api.polyv.net/live/v4/channel/watch/viewer/logout
Request Method
POST
Interface Constraints
- The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls are subject to rate limits. See details
Request Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | true | String | Account appId See details: Get Secret Key |
| timestamp | true | Long | Current 13-digit millisecond timestamp, valid for 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 never be stored on the client side for direct use. All APIs must be called through the customer's own server to relay requests to the POLYV server for response data. See details: Signature Generation Rules |
| channelId | true | Integer | Channel ID |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|---|---|---|
| token | false | String | Session token |
Example
http://api.polyv.net/live/v4/channel/watch/viewer/logout?appId=frlr1zazn3×tamp=1632809855078&channelId=2588188&sign=D02FA683640135D843D485EE84F6632A
Request body JSON parameters:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
}
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine the basic response status |
| status | String | Response result, determined by business logic. Returns "success" on success, "error" on failure |
| success | Boolean | Whether the response was successful |
| requestId | String | Request ID, a unique UUID generated for each request. Only used for troubleshooting and debugging, should not be tied to business logic |
| data | Object | Response data object |
| error | Object | Error information |
error Field Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to determine the specific error reason |
| desc | String | Error description, corresponding to error.code |
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 code project. The test cases include HttpUtil.java and LiveSignUtil.java in the downloaded 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 pooling.
private static final Logger log = LoggerFactory.getLogger(ChannelOperateTest.class);
/**
* 频道观看页观众退出登录
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void testViewerLogout() 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/watch/viewer/logout";
Map<String, String> query = new HashMap<>();
query.put("appId", appId);
query.put("timestamp", timestamp);
query.put("channelId", "2588188");
query.put("sign", LiveSignUtil.getSign(query, appSecret));
Map<String, Object> body = new HashMap<>();
body.put("token", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...");
String fullUrl = HttpUtil.appendUrl(url, query);
String response = HttpUtil.postJsonBody(fullUrl, JSON.toJSONString(body), null);
log.info("返回值:{}", response);
}
Response Example
For system-wide error descriptions, see Global Error Descriptions
Success Example
{
"code": 200,
"status": "success",
"requestId": "847f0716fa76461baf8979aaa4415dc3.67.16342672396023837",
"data": null,
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360831818611581",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
