Query Channel Lottery Records
Legacy API endpoint: Query Channel Lottery Records (Legacy)
API Description
1、查询频道发起抽奖记录
2、接口支持https协议
API URL
http://api.polyv.net/live/v4/channel/lottery/list
Request Method
GET
API Constraints
The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details
When
lotteryIdis not provided,startTimeandendTimeare required.When
lotteryIdis provided,startTimeandendTimeare optional and will be ignored even if passed.The query time span between
startTimeandendTimemust not exceed 365 days.
Request Parameters
| 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 used to generate the signature is critical for data security and must not be used directly on the client side. All APIs must be called through your own server to relay requests to the POLYV server for response data. See: Signature Generation Rules |
| channelId | true | String | Channel ID |
| lotteryId | false | String | Lottery ID |
| sessionId | false | String | Session ID |
| startTime | false | Long | Start time, 13-digit millisecond timestamp |
| endTime | false | Long | End time, 13-digit millisecond timestamp |
| pageNumber | false | Integer | Current page number |
| pageSize | false | Integer | Number of items per page, default 10, maximum 1000 |
Example
http://api.polyv.net/live/v4/channel/lottery/list?appId=frlr1zazn3&sign=CD02AC6E60EE047E7B491C8CB32D23AD&startTime=1629679376000&endTime=1661215376000&channelId=2974342×tamp=1661480931047
Response Parameters
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Status code, same as HTTP status code, used to determine 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. For debugging and troubleshooting only, not for business logic |
| error | Object | Error information when status code is not 200 See: Error Field Description |
| data | Object | List of winning records See: data Field Description |
Error Parameters
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to identify the specific error reason |
| desc | String | Error description, corresponding to error.code |
data Parameters
| Parameter | Type | Description |
|---|---|---|
| pageNumber | Integer | Current page number |
| pageSize | Integer | Number of items per page |
| totalPages | Long | Total number of pages |
| totalItems | Long | Total number of items |
| contents | Array | Content of the current page See: contents Field Description |
contents Parameters
| Parameter | Type | Description |
|---|---|---|
| winnerCount | Integer | Actual number of winners |
| totalUsers | Integer | Number of participants in the lottery |
| lotteryId | String | Lottery session ID |
| channelId | Integer | Channel ID |
| userId | String | Account userId |
| sessionId | String | Live session ID at the time of the lottery |
| lotteryRange | String | Range of lottery candidates |
| actor | String | Title name when drawing by title |
| prize | String | Prize name |
| amount | Integer | Number of winners |
| preset | String | Preset winners, separated by commas |
| lotteryExt | Object | Additional lottery extension information See: lotteryExt Field Description |
| createdTime | Long | Lottery time, 13-digit timestamp |
lotteryExt Parameters
| Parameter | Type | Description |
|---|---|---|
| collectInfo | Array | List of information collected from winners for prize claiming |
collectInfo Parameters
| Parameter | Type | Description |
|---|---|---|
| field | String | Field name |
| tips | String | Fill-in hint |
Java Request Example
For quick integration of basic code, 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 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(getClass());
/**
* 查询频道中奖统计记录
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void getLotteryListTest() 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/lottery/list";
String channelId = "2974342";
String lotteryId = "gcfflpd4ex";
String sessionId = "";
String startTime = "";
String endTime = "";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", channelId);
requestMap.put("lotteryId", lotteryId);
requestMap.put("sessionId", sessionId);
requestMap.put("startTime", startTime);
requestMap.put("endTime", endTime);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url, requestMap);
log.info("测试查询频道中奖统计记录成功:{}", response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "c4a7fb9af5624cbabeb47a4d04c4e13b.72.16614809866840885",
"data": {
"pageNumber": 1,
"pageSize": 10,
"totalPages": 1,
"totalItems": 1,
"contents": [
{
"winnerCount": 2,
"totalUsers": 11,
"lotteryId": "gcfflpd4ex",
"channelId": 2974342,
"userId": "1b448be323",
"sessionId": "gcfd814thr",
"lotteryRange": "all",
"actor": null,
"prize": "一等奖",
"amount": 3,
"preset": "",
"lotteryExt": {
"collectInfo": [
{
"field": "姓名:",
"tips": "请输入您的真实姓名"
},
{
"field": "手机:",
"tips": "请输入您的手机号码"
}
]
},
"createdTime": 1660022052000
}
]
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
