Paginated Detailed List of Q&A
Updated: 2022-09-02 18:08:07
Interface URL
https://api.polyv.net/live/v3/channel/consultation/detail-list
Interface Description
1、分页获取问答的详细列表
2、支持分页
3、接口支持https
Supported Format
JSON
Request Method
GET
Request Limit
TRUE
Request Parameters
| Parameter | Required | Type | Description |
|---|---|---|---|
| appId | Yes | string | Obtained from API settings, the appId registered in the live streaming system |
| timestamp | Yes | long | Current 13-digit millisecond timestamp, valid within 3 minutes |
| sign | Yes | 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 |
| channelId | Yes | int | Channel ID |
| sessionId | No | string | Session ID |
| startTime | No | long | Start time of the live broadcast time range to query |
| endTime | No | long | End time of the live broadcast time range to query |
| page | No | int | Current page, default is 1 |
| size | No | int | Number of items per page, default is 10 |
Successful Response JSON Example:
{
"code":200,
"status":"success",
"message":"",
"data":{
"pageSize":5,
"pageNumber":1,
"totalItems":23,
"contents":[
{
"askTime":"2021-03-15 14:36",
"nick":"啊啊啊啊",
"viewerId":"1615773668801",
"sessionId":"fwqzqpj6sf",
"content":"开导开导看",
"status":"未处理",
"reply":null
},
{
"askTime":"2021-03-15 14:36",
"nick":"啊啊啊啊",
"viewerId":"1615773668801",
"sessionId":"fwqzqpj6sf",
"content":"大大方方",
"status":"未处理",
"reply":null
},
{
"askTime":"2021-03-15 14:36",
"nick":"啊啊啊啊",
"viewerId":"1615773668801",
"sessionId":"fwqzqpj6sf",
"content":"少时诵诗书",
"status":"未处理",
"reply":null
},
{
"askTime":"2021-03-15 14:36",
"nick":"啊啊啊啊",
"viewerId":"1615773668801",
"sessionId":"fwqzqpj6sf",
"content":"1111111",
"status":"未处理",
"reply":null
},
{
"askTime":"2021-03-15 14:36",
"nick":"啊啊啊啊",
"viewerId":"1615773668801",
"sessionId":"fwqzqpj6sf",
"content":"2222222",
"status":"未处理",
"reply":null
}
],
"startRow":1,
"firstPage":true,
"lastPage":false,
"prePageNumber":1,
"limit":5,
"totalPages":5,
"nextPageNumber":2,
"endRow":5,
"offset":0
}
}
Failed Response JSON Examples:
appId not provided
{
"code": 400,
"status": "error",
"message": "appId is required.",
"data": ""
}
Incorrect appId
{
"code": 400,
"status": "error",
"message": "application not found.",
"data": ""
}
Timestamp error
{
"code": 400,
"status": "error",
"message": "invalid timestamp.",
"data": ""
}
Signature error
{
"code": 403,
"status": "error",
"message": "invalid signature.",
"data": ""
}
Invalid channel
{
"code": 403,
"status": "error",
"message": "illegal channel id: 1779742",
"data": ""
}
Invalid parameter
{
"code": 400,
"status": "error",
"message": "param is not digit: size",
"data": ""
}
Field Description
| Parameter | Type | Description |
|---|---|---|
| code | int | Response code: 200 for success, 400 for failure, 401 for signature error, 500 for exception error |
| status | string | "success" for success, "error" for failure |
| message | string | Error message when an error occurs |
| data | object | Response result set |
| pageNumber | int | Current page number |
| totalItems | int | Total number of items |
| contents | array | List of query results |
| askTime | string | Time of the question |
| nick | string | Nickname of the user who asked |
| viewerId | string | ID of the user who asked |
| sessionId | string | The live broadcast session it belongs to |
| content | string | Content of the question |
| status | string | Status of the Q&A, e.g., "unprocessed", "replied", etc. |
| reply | string | Reply content to the question |
| firstPage | boolean | Whether it is the first page, value: true/false |
| lastPage | boolean | Whether it is the last page, value: true/false |
| nextPageNumber | int | Next page number |
| prePageNumber | int | Previous page number |
| totalPages | int | Total number of pages |
| startRow | int | Position of the first item on the current page |
| endRow | int | Position of the last item on the current page |
| limit | int | Number of items per page |
Java Request Example
public static void main(String[] args) {
String url = "https://api.polyv.net/live/v3/channel/consultation/detail-list";
// 用户对应的appId和加密串
String appId = "xxxxxxxxx";
String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
Map<String, String> params = new HashMap<>();
params.put("channelId", "0000000");
params.put("page", "1");
params.put("size", "10");
PolyvTool.setLiveSign(params, appId, appSecret);
// 调用Polyv的httpClient工具类发送请求
String content = HttpClientUtil.getInstance()
.sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
System.out.println(content);
}
