Polyv Help Center

Help Center

Query Lottery Records for Multiple Channels

Updated: 2022-09-27 11:32:05

API Description

1、获取一段时间内的多个直播频道发起抽奖记录列表
2、接口支持https协议

API URL

http://api.polyv.net/live/v3/channel/lottery/list-channels-lottery

Online API Call

Request Method

GET

API Constraints

  1. The API supports both HTTP and HTTPS. HTTPS is recommended for security. API calls have frequency limits. See details

Request Parameters

Parameter Required Type Description
appId true String Account appId See details on obtaining keys
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 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
channelIds true String Channel IDs, multiple channels separated by commas
startTime true Long Start date for the query, 13-digit timestamp
endTime true Long End date for the query, 13-digit timestamp
sessionId false String Live session ID to query. Defaults to all sessions in the channel
page false Integer Page number for the query, defaults to 1
limit false Integer Number of records per page, defaults to 10

Example

http://api.polyv.net/live/v3/channel/lottery/list-lottery?appId=frlr1zazn3&sign=CFD9DDABAD30A5F2CFA1E1FCD26E2FC7&startTime=1615772426000&endTime=1615773566000&channelId=2191532,2383918&timestamp=1621844928632

Response Parameters

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 Object Paginated lottery records See data field description

data Field Description

Parameter Type Description
pageSize Integer Total number of pages
pageNumber Integer Current page number
totalItems Integer Total number of records
contents List<LotteryListModel> List of lottery records See contents field description
offset Integer Starting record for pagination
limit Integer Number of records on the current page
nextPageNumber Integer Next page number
startRow Integer Position of the first record on the current page in the total records
lastPage Boolean Whether it is the last page, values: true/false
prePageNumber Integer Previous page number
firstPage Boolean Whether it is the first page, values: true/false
totalPages Integer Total number of pages
endRow Integer Position of the last record on the current page in the total records

contents Field Description

Parameter Type Description
lotteryId String Lottery session ID
channelId String Channel ID
sessionId String Live session ID during the lottery
userId String Account userId
lotteryRange String Lottery scope
all: All viewers
notWinning: Viewers who did not win in the current live session
signed: Signed-in viewers
actor: Title-based
questionnaire: Viewers who completed the questionnaire
actor String Title when the lottery scope is title-based
prize String Prize name
amount Integer Preset number of winners
preset String Preset winner viewer IDs, multiple IDs separated by commas
createdTime Long Lottery creation time
lastModified Long Last modification time
winnerCount String Actual number of winners
ext String JSON string representing additional lottery information. Corresponding model class: LotteryListModelExt field description

LotteryListModelExt Field Description

Description: Additional information for lottery records

Field Type Description
collectInfo Array Prize claim information required from winners. Corresponding model class: CollectInfoFieldModel field description

CollectInfoFieldModel Field Description

Description: Prize claim information required from winners

Field Type and Range Description
field String Field name to fill in
tips String Field prompt to fill in

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 packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pooling.

private static final Logger log = LoggerFactory.getLogger(LiveInteractionTest.class);
/**
 * 查询频道中奖记录
 * @throws IOException
 */
@Test
public void testListLottery() throws IOException, NoSuchAlgorithmException {
    //公共参数,填写自己的实际参数
    String appId=super.appId;
    String appSecret=super.appSecret;
    String userId = super.userId;
    String timestamp=String.valueOf(System.currentTimeMillis());
    //业务参数
    String url = "http://api.polyv.net/live/v3/channel/lottery/list-channels-lottery";
    String channelId = "1965681,2383918";
    String startTime = "1601481600000";
    String endTime = "1615357743000";

    //http 调用逻辑
    Map<String,String> requestMap = new HashMap<>();
    requestMap.put("appId", appId);
    requestMap.put("timestamp",timestamp);

    requestMap.put("channelId",channelId);
    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",
    "message": "",
    "data": {
        "pageSize": 10,
        "pageNumber": 1,
        "totalItems": 2,
        "contents": [{
            "lotteryId": "fv3mao43u6",
            "channelId": 1965681,
            "userId": "1b448be323",
            "sessionId": "fv3ma84e63",
            "lotteryRange": "all",
            "actor": null,
            "prize": "特等奖",
            "amount": 1,
            "preset": "",
            "createdTime": 1611137383000,
            "lastModified": 1611137383000,
            "ext": "{\"collectInfo\":[{\"field\":\"姓名:\",\"tips\":\"请输入您的真实姓名\"},{\"field\":\"手机:\",\"tips\":\"请输入您的手机号码\"}]}",
            "winnerCount": "0"
        }, {
            "lotteryId": "fv3hogjmh3",
            "channelId": 1965681,
            "userId": "1b448be323",
            "sessionId": "fv3hmq3qml",
            "lotteryRange": "all",
            "actor": null,
            "prize": "10元现金红包",
            "amount": 1,
            "preset": "",
            "createdTime": 1611127333000,
            "lastModified": 1611127333000,
            "ext": "{\"collectInfo\":[{\"field\":\"姓名:\",\"tips\":\"请输入您的真实姓名\"},{\"field\":\"手机:\",\"tips\":\"请输入您的手机号码\"}]}",
            "winnerCount": "1"
        }],
        "startRow": 1,
        "firstPage": true,
        "lastPage": true,
        "prePageNumber": 1,
        "limit": 2,
        "nextPageNumber": 1,
        "totalPages": 1,
        "endRow": 2,
        "offset": 0
    }
}

Error Example

{
    "code": 400,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
联系客服,在线咨询