Query Channel Image-Text Live Content
Updated: 2022-09-02 18:08:07
Interface Description
1、查询频道图文直播内容
2、接口支持https协议
Interface URL
http://api.polyv.net/live/v3/channel/watch/tuwen/list
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
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 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 saved 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 and obtain response data. See Signature Generation Rules |
| channelId | true | String | Channel ID |
| id | false | Integer | Sequence number of the image-text content: empty means fetching the first page of data, and pinned data will also be returned. Non-empty means fetching records with an ID smaller than this value (i.e., earlier published content), and pinned list will not be returned. |
| imageMode | false | String | Whether it is image mode, default is N Y: Image mode N: Text and image mode |
Example
https://api.polyv.net/live/v3/channel/watch/tuwen/list?appId=frlr1zazn3&sign=9E82CCD014CBBBE72EC6306D05A331E3&imageMode=N&channelId=2149710×tamp=1621842666131
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, when code is 400 or 500, provides auxiliary error reason |
| data | Object | Paginated replay details data on success See data Field Description |
data Field Description
| Parameter | Type | Description |
|---|---|---|
| total | Integer | Total number of returned results |
| contents | Array | List of returned image-text content See contents Field Description |
| topContents | Array | Pinned image-text information See topContents Field Description |
| setting | Object | Image-text live related settings See setting Field Description |
contents Field Description
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Image-text content sequence number, can be used as query parameter id |
| channelId | String | Channel ID |
| text | String | Text content |
| images | Array | Image URLs, format: ["http://liveimages.net//chat.jpeg","http://liveimages.net//chat2.jpeg"] |
| top | String | Whether pinned Y: Yes N: No |
| createdTime | Integer | Content send time, 13-digit timestamp |
topContents Field Description
| Parameter | Type | Description |
|---|---|---|
| id | Integer | Image-text content sequence number, can be used as query parameter id |
| channelId | String | Channel ID |
| text | String | Text content |
| images | Array | Image URLs, format: ["http://liveimages.net//chat.jpeg","http://liveimages.net//chat2.jpeg"] |
| top | String | Whether pinned Y: Yes N: No |
| createdTime | Long | Content send time, 13-digit timestamp |
setting Field Description
| Parameter | Type | Description |
|---|---|---|
| nickname | String | Operator's nickname |
| actor | String | Operator's title |
| avatar | String | Operator's avatar |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click to download source code. After downloading, add it to your own source project. HttpUtil.java and LiveSignUtil.java in the test cases are included 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(MenuTest.class);
/**
* 查询频道图文直播内容
* @throws IOException
*/
@Test
public void testTuwenList() 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/watch/tuwen/list";
String channelId = "2149710";
String imageMode = "N";
//http 调用逻辑
Map<String,String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp",timestamp);
requestMap.put("channelId",channelId);
requestMap.put("imageMode",imageMode);
requestMap.put("sign",LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.postFormBody(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": {
"total": 4,
"contents": [{
"id": 114225,
"channelId": 2149710,
"text": "<p>图片测试2</p>",
"images": ["http://liveimages.videocc.net/uploadimage/20210309/chat_img_2149710_16152571693814.jpeg"],
"top": "N",
"createdTime": 1615257175000
}, {
"id": 114223,
"channelId": 2149710,
"text": "<p>加图片测试</p>",
"images": ["http://liveimages.videocc.net/uploadimage/20210309/chat_img_2149710_16152570796353.jpeg"],
"top": "N",
"createdTime": 1615257089000
}],
"topContents": [],
"setting": {
"id": 109036,
"nickname": "请问123",
"actor": "主持人",
"avatar": "//liveimages.videocc.net/assets/wimages/pc_images/logo.png"
}
}
}
Error Example
{
"code": 400,
"status": "error",
"message": "invalid signature.",
"data": ""
}
