Polyv Help Center

Help Center

Query Default Template Tip Settings

Updated: 2022-12-12 11:51:12

Interface Description

1、查询直播模板打赏设置,包括现金打赏、礼物打赏,礼物打赏又分为现金支付和积分支付
2、接口支持https协议

Interface URL

http://api.polyv.net/live/v4/user/donate/get

Online API Call

Request Method

GET

Interface Constraints

  1. The interface supports both HTTP and HTTPS. HTTPS is recommended to ensure interface security. Interface calls have frequency limits. See details

Request Parameter Description

Parameter Required Type Description
appId true String Account appId See details
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 signature generation rules

Example

http://api.polyv.net/live/v4/user/donate/get?appId=frlr1zazn3&sign=0EEE910FFD45B0DCD4A71D490DEB83D6&timestamp=1631091211556

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, not related to business logic

Error Parameter Description

Parameter Type Description
code Integer Error code, used to identify the specific error reason
desc String Error description, corresponding to error.code

Data Parameter Description

Parameter Type Description
donateCashEnabled String Cash red envelope tip toggle: Y for enabled, N for disabled
cashDonate Object Cash red envelope See TemplateCashDonateBO field description
donateGiftEnabled String Gift tip toggle: Y for enabled, N for disabled
giftDonate Object Gift tip (cash payment or points payment) See TemplateGiftDonateBO field description

TemplateCashDonateBO Parameter Description

Parameter Type Description
cashs Array Fixed tip amounts, array length 1-6, minimum value 0.01, maximum value 9999.99
cashMin Float Custom tip amount - minimum amount, minimum value 0.01, maximum value 9999.99

TemplateGiftDonateBO Parameter Description

Parameter Type Description
payWay String Payment method: CASH for cash payment, POINT for 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
dynamicImg String Dynamic effect thumbnail
dynamicFile String Dynamic effect file
price Float Gift price
sequence Integer Gift order
enabled String Toggle: Y for enabled, N for disabled
unit String Unit
imgType String Unit: STATIC for static image, DYNAMIC for dynamic image

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. HttpUtil.java and LiveSignUtil.java in the test cases are included in the downloaded file.

It is strongly recommended to use the Live Java SDK for API functionality 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(UserDonateTest.class);

    @Test
    public void getUserDonate() 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/user/donate/get";
        
        //http 调用逻辑
        Map<String, String> requestMap = new HashMap<>();
        requestMap.put("appId", appId);
        requestMap.put("timestamp", timestamp);
        
        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": "4b38eabb79824a409e7fd149f03425d7.73.16708091734594439",
    "data": {
        "donateCashEnabled": "Y",
        "donateGiftEnabled": "Y",
        "cashDonate": {
            "cashs": [
                0.81,
                6.62,
                8.83,
                18.84,
                66.65,
                88.86
            ],
            "cashMin": 0.02
        },
        "giftDonate": {
            "payWay": "POINT",
            "cashUnit": null,
            "pointUnit": "polyv积分",
            "cashPays": [
                {
                    "name": "金手指",
                    "img": "",
                    "dynamicImg": "//liveimages.videocc.net/uploaded/images/2022/12/gg94fabgsb.png",
                    "dynamicFile": "https://liveimages.videocc.net/uploaded/files/1b448be323/2022/12/gg932fa78u.svga",
                    "price": 1.11,
                    "sequence": 0,
                    "enabled": "Y",
                    "unit": null,
                    "imgType": "DYNAMIC"
                },
                {
                    "name": "红玫瑰",
                    "img": "//liveimages.videocc.net/uploaded/images/2021/11/g41in083xo.png",
                    "dynamicImg": null,
                    "dynamicFile": null,
                    "price": 6.66,
                    "sequence": 1,
                    "enabled": "Y",
                    "unit": null,
                    "imgType": null
                }
            ],
            "pointPays": [
                {
                    "name": "666",
                    "img": "//s1.videocc.net/default-img/donate/666.png",
                    "dynamicImg": null,
                    "dynamicFile": null,
                    "price": 12.88,
                    "sequence": 0,
                    "enabled": "Y",
                    "unit": null,
                    "imgType": null
                },
                {
                    "name": "恭喜发财",
                    "img": "https://liveimages.videocc.net/uploaded/images/2021/11/g4b3010gmm.gif",
                    "dynamicImg": null,
                    "dynamicFile": null,
                    "price": 66.88,
                    "sequence": 1,
                    "enabled": "Y",
                    "unit": null,
                    "imgType": null
                }
            ]
        }
    },
    "success": true
}

Error Example

{
    "code": 400,
    "status": "error",
    "requestId": "d310b70bc329403f87f77f9203d50f89.128.16360832331303627",
    "error": {
        "code": 20001,
        "desc": "application not found."
    },
    "success": false
}
联系客服,在线咨询
在线咨询