> For the complete documentation index, see [llms.txt](https://polyv.gitbook.io/document/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://polyv.gitbook.io/document/docs/unclassified/2020/8ff19595e59309df871d6aa137aa68db.md).

# 获取观众积分打赏的积分

### 接口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示例：

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

### 响应失败JSON示例：

token过期了

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

非法的token

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

必填参数不能空

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

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

非法的访问

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

### 字段说明

| 参数名     | 说明                                  |
| ------- | ----------------------------------- |
| code    | 响应代码，成功为200，失败为400，签名错误为403，异常错误500 |
| status  | 成功为success，失败为error                 |
| message | 错误时为错误提示消息                          |
| data    | int，返回观众对应的可用积分数                    |

### Java请求示例

```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);
    }
```
