Query Coupon List
Updated: 2025-06-10 10:28:31
API Description
1、查询优惠券列表
2、接口支持https协议
API URL
https://api.polyv.net/live/v4/user/coupon/search
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. API calls have frequency 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 within 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 details: Signature Generation Rules |
| pageNumber | false | Integer | Page number, defaults to 1 |
| pageSize | false | Integer | Number of records per page, defaults to 10, maximum cannot exceed 1000 |
| couponId | false | String | Coupon ID |
| name | false | String | Coupon name | Fuzzy match |
| status | false | String | Status: NOT_START, GOING, FINISHED, INVALID |
Request Body Parameter Description
| Parameter | Required | Type | Description |
|---|
Example
https://api.polyv.net/live/v4/user/coupon/search?appId=frlr1zazn3&sign=012332FBD8DBCFC068AFCB484A2ADECB×tamp=1670550787318&pageNumber=1&pageSize=10
Response Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Response status code, 200 for success, non-200 for failure |
| status | String | Response result, determined by business logic, success returns "success", failure returns "error" |
| success | Boolean | Response result, determined by business logic, success returns true, failure returns false |
| data | Object | Tag data [See Data field description](#Data Parameter Description) |
| error | Object | Error information when status code is non-200 See Error field description |
| requestId | String | Request ID, a unique UUID generated for each request, used only for troubleshooting and debugging, should not be tied to business logic |
Data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| pageNumber | Integer | Current page number |
| pageSize | Integer | Number of records per page |
| totalPages | Long | Total number of pages |
| totalItems | Long | Total number of records |
| contents | Array | Current page content See contents field description |
Contents Parameter Description
| Parameter | Type | Description |
|---|---|---|
| couponId | String | Coupon ID |
| name | String | Coupon name |
| receiveStartTime | Long | Coupon claim start time, 13-digit millisecond timestamp |
| receiveEndTime | Long | Coupon claim end time, 13-digit millisecond timestamp |
| useTimeType | String | Coupon usage time type, RANGE - time range, DAY - number of days |
| useStartTime | Long | Parameter for useTimeType=RANGE: Coupon usage start time, 13-digit millisecond timestamp |
| useEndTime | Long | Parameter for useTimeType=RANGE: Coupon usage end time, 13-digit millisecond timestamp |
| dayOfUse | Integer | Parameter for useTimeType=DAY: Number of days available after claiming |
| availableAmount | Integer | Number of coupons issued, greater than or equal to 0 |
| rule | UserCouponRule | Coupon rule See details: UserCouponRule |
UserCouponRule
| Parameter | Type | Description |
|---|---|---|
| condition | String | Coupon usage condition (UNCONDITIONAL - No threshold, FULL_REDUCE - Spend and save) |
| unconditional | Unconditional | No threshold: unconditional and fullReduce, See details: Unconditional |
| fullReduce | FullReduce | Spend and save: unconditional and fullReduce, See details: FullReduce |
| limitPerPerson | Integer | Limit per person: -1 means no limit |
Unconditional
| Parameter | Required | Type | Description |
|---|---|---|---|
| enable | true | boolean | Whether enabled: true - on, false - off |
| value | true | double | Value |
| unit | true | String | Unit: MONEY - Yuan, DISCOUNT - Percent |
FullReduce
| Parameter | Required | Type | Description |
|---|---|---|---|
| enable | true | boolean | Whether enabled: true - on, false - off |
| full | true | double | Minimum spend amount |
| reduce | true | double | Discount amount |
| unit | true | String | Unit: MONEY - Yuan, DISCOUNT - Percent |
Error Parameter Description
| Parameter | Type | Description |
|---|---|---|
| code | Integer | Error code, used to identify the specific error reason |
| desc | String | Error description, corresponds 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 packaging and optimization for API call logic, exception handling, data signing, and HTTP request thread pooling.
private final Logger log = LoggerFactory.getLogger(getClass());
/**
* 查询优惠券列表
* @throws IOException
* @throws NoSuchAlgorithmException
*/
@Test
public void listCouponTest() throws IOException, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String appId = super.appId;
String appSecret = super.appSecret;
String timestamp = String.valueOf(System.currentTimeMillis());
//业务参数
String url = "https://api.polyv.net/live/v4/user/coupon/search";
Integer pageNumber = 1;
Integer pageSize = 10;
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("pageNumber", pageNumber);
requestMap.put("pageSize", pageSize);
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
url = HttpUtil.appendUrl(url, requestMap);
String response = HttpUtil.get(url, null);
log.info("测试查询主播列表结果:{}", response);
//do somethings
}
Response Example
For global error descriptions, see Global Error Description
Success Example
{
"code": 200,
"data": {
"contents": [
{
"availableAmount": 999,
"couponId": "caqfi6rqutunvofor5jrqbinswh14p2g",
"dayOfUse": 30,
"name": "优惠券2号",
"receiveEndTime": 1756102919000,
"receiveStartTime": 1748326919000,
"receivedAmount": 0,
"rule": {
"condition": "UNCONDITIONAL",
"limitPerPerson": -1,
"unconditional": {
"enable": true,
"unit": "MONEY",
"value": 1.0
}
},
"status": "GOING",
"useEndTime": 1756102919000,
"useStartTime": 1748326919000,
"useTimeType": "RANGE"
}
],
"pageNumber": 1,
"pageSize": 10,
"totalItems": 1,
"totalPages": 1
},
"requestId": "d7567a16-86f0-4a7c-a8bd-6f140a2a46f4",
"status": "success",
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "d310b70bc329403f87f77f9203d50f89.128.16360831552223589",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
