Query Channel Donation Settings (New Admin Panel)
Updated: 2023-03-15 10:54:26
Legacy API endpoint Query Channel Donation Settings (Legacy)
API Description
1、查询频道打赏设置,包括现金打赏、礼物打赏,礼物打赏又分为现金支付和积分支付
2、接口支持https协议
API URL
http://api.polyv.net/live/v4/channel/donate/get
Request Method
GET
API Constraints
- The API supports both HTTP and HTTPS. HTTPS is recommended to ensure API security. API calls are subject to rate 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 stored or used directly on the client side. All APIs must be called from your own server to relay requests to the POLYV server for response data. See Signature Generation Rules |
| channelId | true | String | Channel ID |
Example
http://api.polyv.net/live/v4/channel/donate/get?appId=frlr1zazn3&sign=16DC042339E27BAD00452D004C1FA9CA&channelId=2523307×tamp=1631064094801
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 | Channel details returned on successful response See data field 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. Only used for troubleshooting and debugging, should not be tied to business logic |
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 |
data Parameter Description
| Parameter | Type | Description |
|---|---|---|
| donateCashEnabled | String | Cash red envelope donation toggle: Y = enabled, N = disabled |
| cashDonate | Object | Cash red envelope See TemplateCashDonateBO field description |
| donateGiftEnabled | String | Gift donation toggle: Y = enabled, N = disabled |
| giftDonate | Object | Gift donation (cash or points payment) See TemplateGiftDonateBO field description |
TemplateCashDonateBO Parameter Description
| Parameter | Type | Description |
|---|---|---|
| cashs | Array |
Fixed donation amounts, array length 1-6, minimum value 0.01, maximum value 9999.99 |
| cashMin | Float | Custom donation amount - minimum amount, minimum value 0.01, maximum value 9999.99 |
TemplateGiftDonateBO Parameter Description
| Parameter | Type | Description |
|---|---|---|
| payWay | String | Payment method: CASH = cash payment, POINT = points payment |
| cashUnit | String | Cash unit |
| pointUnit | String | Points unit |
| cashPays | Array | Cash payment list See GiftDonate field description |
| pointPays | Array | Points payment list See GiftDonate field description |
GiftDonate Parameter Description
| Parameter | Type | Description |
|---|---|---|
| name | String | Gift name |
| img | String | Gift image URL |
| price | Float | Gift price |
| enabled | String | Toggle: Y = enabled, N = disabled |
Java Request Example
For quick integration of basic code, please download the relevant dependency source code. Click here to download 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 encapsulation and optimization for API call logic, exception handling, data signing, and HTTP request thread pools.
private static final Logger log = LoggerFactory.getLogger(ChannelDonateTest.class);
@Test
public void testGetDonate() 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/donate/get";
//http 调用逻辑
Map<String, String> requestMap = new HashMap<>();
requestMap.put("appId", appId);
requestMap.put("timestamp", timestamp);
requestMap.put("channelId", "2523307");
requestMap.put("sign", LiveSignUtil.getSign(requestMap, appSecret));
String response = HttpUtil.get(url,requestMap);
log.info("测试查询频道打赏设置,返回值:{}", response);
}
Response Example
For global system error descriptions, see Global Error Description
Success Example
{
"code": 200,
"status": "success",
"requestId": "5d413aa5dc6b4cc1b79d4374aa5ac974.67.16310640996487509",
"data": {
"donateCashEnabled": "N",
"donateGiftEnabled": "N",
"cashDonate": {
"cashs": [
0.88,
6.66,
8.88,
18.88,
66.6,
88.8
],
"cashMin": 0.01
},
"giftDonate": {
"payWay": null,
"cashUnit": "元",
"pointUnit": "点",
"cashPays": [
{
"name": "666",
"img": "//s1.videocc.net/default-img/donate/666.png",
"price": 6.66,
"sequence": 0,
"enabled": "Y"
},
{
"name": "掌声",
"img": "//s1.videocc.net/default-img/donate/handclap.png",
"price": 88.99,
"sequence": 0,
"enabled": "Y"
},
{
"name": "点赞",
"img": "//s1.videocc.net/default-img/donate/like.png",
"price": 1.99,
"sequence": 0,
"enabled": "Y"
},
{
"name": "小星星",
"img": "//s1.videocc.net/default-img/donate/star.png",
"price": 9.99,
"sequence": 0,
"enabled": "N"
},
{
"name": "钻石",
"img": "//s1.videocc.net/default-img/donate/diamond.png",
"price": 19.99,
"sequence": 0,
"enabled": "N"
},
{
"name": "跑车",
"img": "//s1.videocc.net/default-img/donate/car.png",
"price": 29.99,
"sequence": 0,
"enabled": "N"
},
{
"name": "火箭",
"img": "//s1.videocc.net/default-img/donate/rocket.png",
"price": 66.66,
"sequence": 0,
"enabled": "N"
}
],
"pointPays": [
{
"name": "咖啡",
"img": "//s1.videocc.net/default-img/donate/coffee.png",
"price": 5,
"sequence": 1,
"enabled": "Y"
},
{
"name": "鲜花",
"img": "//s1.videocc.net/default-img/donate/flower.png",
"price": 0,
"sequence": 2,
"enabled": "Y"
},
{
"name": "点赞",
"img": "//s1.videocc.net/default-img/donate/like.png",
"price": 10,
"sequence": 3,
"enabled": "Y"
},
{
"name": "掌声",
"img": "//s1.videocc.net/default-img/donate/handclap.png",
"price": 15,
"sequence": 4,
"enabled": "Y"
},
{
"name": "666",
"img": "//s1.videocc.net/default-img/donate/666.png",
"price": 20,
"sequence": 5,
"enabled": "Y"
},
{
"name": "小星星",
"img": "//s1.videocc.net/default-img/donate/star.png",
"price": 25,
"sequence": 6,
"enabled": "Y"
},
{
"name": "钻石",
"img": "//s1.videocc.net/default-img/donate/diamond.png",
"price": 30,
"sequence": 7,
"enabled": "Y"
},
{
"name": "烟火",
"img": "//s1.videocc.net/default-img/donate/fireworks.png",
"price": 35,
"sequence": 8,
"enabled": "Y"
},
{
"name": "金蛋",
"img": "//s1.videocc.net/default-img/donate/golden-egg.png",
"price": 40,
"sequence": 9,
"enabled": "Y"
},
{
"name": "奖杯",
"img": "//s1.videocc.net/default-img/donate/cup.png",
"price": 45,
"sequence": 10,
"enabled": "Y"
},
{
"name": "跑车",
"img": "//s1.videocc.net/default-img/donate/car.png",
"price": 50,
"sequence": 11,
"enabled": "Y"
},
{
"name": "皇冠",
"img": "//s1.videocc.net/default-img/donate/crown.png",
"price": 60,
"sequence": 12,
"enabled": "Y"
},
{
"name": "别墅",
"img": "//s1.videocc.net/default-img/donate/house.png",
"price": 65,
"sequence": 13,
"enabled": "Y"
},
{
"name": "游艇",
"img": "//s1.videocc.net/default-img/donate/yacht.png",
"price": 70,
"sequence": 14,
"enabled": "Y"
},
{
"name": "飞机",
"img": "//s1.videocc.net/default-img/donate/plane.png",
"price": 88,
"sequence": 15,
"enabled": "Y"
},
{
"name": "火箭",
"img": "//s1.videocc.net/default-img/donate/rocket.png",
"price": 100,
"sequence": 16,
"enabled": "Y"
}
]
}
},
"success": true
}
Error Example
{
"code": 400,
"status": "error",
"requestId": "4081dbac03e6441e8bdd301d8feee5a2.124.16360828110501391",
"error": {
"code": 20001,
"desc": "application not found."
},
"success": false
}
