获取观众积分打赏的积分

接口URL

https://api.polyv.net/live/v3/channel/donate/point/get

接口说明

1、接口用于获取观众积分打赏的积分
2、接口支持https

返回结果格式

JSON

请求方式

GET

请求参数

参数名必选类型说明

token

string

接口请求的凭证

channelId

int

频道号

viewerId

string

观众ID

nickname

string

观众昵称,做urlencode

响应成功JSON示例:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data":  100
}

响应失败JSON示例:

token过期了

{
    "code": 400,
    "status": "error",
    "message": "token expired",
    "data": ""
}

非法的token

{
    "code": 400,
    "status": "error",
    "message": "invalid token.",
    "data": ""
}

必填参数不能空

{
    "code": 400,
    "status": "error",
    "message": "param should not be empty: viewerId",
    "data": ""
}
{
    "code": 400,
    "status": "error",
    "message": "param should not be empty: channelId",
    "data": ""
}

非法的访问

{
    "code": 400,
    "data": "",
    "message": "forbidden",
    "status": "error"
}

字段说明

参数名说明

code

响应代码,成功为200,失败为400,签名错误为403,异常错误500

status

成功为success,失败为error

message

错误时为错误提示消息

data

int,返回观众对应的可用积分数

Java请求示例

public static void test() {
        String url = "https://api.polyv.net/live/v3/channel/donate/point/get";
        String token = "xxxxxxxxx";
        String viewerId = "xxxxxxxxxxxxxxxxxxxxxxxxxx";
        int channelId = 10001;
        Map<String, String> params = new HashMap<>();
        params.put("channelId", channelId);
		params.put("viewerId", viewerId);
		params.put("token", token);
        // 调用Polyv的httpClient工具类发送请求
        String content = HttpClientUtil.getInstance()
                .sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
        System.out.println(content);
    }

Last updated