Member接口
接口调用时须在请求头中设置whaleal-Token ,填写参数发起请求,返回内容为 JSON 格式的信息,返回特殊实体类将在最后提供实体类表格。
有些接口调用时需用到ID、memberId、messageId
Id为用户ID,在“保存新用户信息”接口处返回data里的id为用户ID。
memberId为用户ID,在“保存新用户信息”接口处返回data里的id为用户ID。
messageId为消息id,在“获取信息数据”接口处返回的实体类中的id。
请求头默认格式,特殊情况特殊声明
whaleal-Token在调用登录接口时返回,在之后调用接口时将whaleal-Token放置请求头中。
| KEY | VALUE |
|---|---|
| Accept-Encoding | gzip,deflate,br |
| Connection | keep-alive |
| Content-Type | application/json |
| whaleal-token | "token" |
1 登录
1.1 请求路径
POST: http://{Server-Host}:{端口}/api/server/member/login
1.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| account | Body | 账户名 | Yes | String |
| password | Body | 密码 | Yes | String |

1.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | JSON |
| generateAgentIdAble | 是否有权限生成agentId | boolean |
| token | Token令牌 | String |
| createMongoDBAble | 是否有权限创建mongo集群 | boolean |
{
"code": 1000,
"data": {
"id": "62be61c7cbeff906da28f6ff",
"createTime": 1656644040004,
"updateTime": 1657690356662,
"account": "chen123",
"password": "",
"email": "1q@q.com",
"areaCode": "86",
"phone": "17698999999",
"role": "admin",
"timezone": "Asia/Shanghai",
"receiveAlert": true,
"dingDingList": []
},
"createMongoDBAble": true,
"generateAgentIdAble": true,
"token": ""
}
2 保存新用户信息.
2.1 请求路径
POST: http://{Server-Host}:{端口}/api/server/member/register
2.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberMongoEntity | Body | 用户实体对象 | Yes | MemberMongoEntity |

Ex. 保存新用户信息;其中 MemberMongoEntity 如下所示:
{
"account": "chen123556",
"password": "123456",
"email": "123356789@qq.com",
"phone": "17699969999"
}
2.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | JSON |
{
"code": 1000,
"data": {
"id": "62da7bd6239d00094230b525",
"createTime": 1658485718459,
"updateTime": 1658485718459,
"account": "chen123556",
"password": "",
"email": "123356789@qq.com",
"areaCode": "86",
"phone": "17699969999",
"role": "admin",
"timezone": "Asia/Shanghai",
"receiveAlert": true,
"dingDingList": []
}
}
3 更新用户信息
3.1 请求路径
POST: http://{Server-Host}:{端口}/api/server/member/update
3.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberMongoEntity | Body | 用户实体对象 | Yes | MemberMongoEntity |

Ex. 更新用户信息;其中 MemberMongoEntity 如下所示:
{
"id": "62be61c7cbeff906da28f6ff",
"createTime": 1659602792412,
"updateTime": 1659605792412,
"account": "chen123",
"password": "",
"email": "110236111@qq.com",
"areaCode": "86",
"phone": "17699999999",
"role": "admin",
"timezone": "A1",
"receiveAlert": true,
"dingDingList": [
"_"
],
"avatar": ""
}
3.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | JSON |
{
"code": 1000,
"data": {
"id": "62da7bd6239d00094230b525",
"createTime": 1658485718459,
"updateTime": 1658486089634,
"account": "chen123556",
"password": "",
"email": "98765221@qq.com",
"areaCode": "86",
"phone": "17699954999",
"role": "admin",
"timezone": "Asia/Shanghai",
"receiveAlert": true,
"dingDingList": []
}
}
4 搜索用户
4.1 请求路径
POST: http://{Server-Host}:{端口}/api/server/member/findMemberData//
4.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| pageSize | Path | 每页大小 | Yes | int |
| pageIndex | Path | 第几页 | Yes | int |
| map | Body | 用户信息 | Yes | Map |

Ex. 搜索用户;其中 Map 如下所示:
{
"account": "chen",
"phone": "176",
"email": "11"
}
4.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | List |
{
"code": 1000,
"data": [
{
"id": "62d8b50b239d00094230b37c",
"createTime": 1658369291763,
"updateTime": 1658369291763,
"account": "chen123456",
"password": null,
"email": "123456789@qq.com",
"areaCode": "86",
"phone": "17699999999",
"role": "admin",
"timezone": "Asia/Shanghai",
"receiveAlert": true,
"dingDingList": []
}
]
}
5 查询用户数量
5.1 请求路径
POST: http://{Server-Host}:{端口}/api/server/member/findMemberCount
5.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| map | Body | 用户信息 | Yes | Map |

Ex. 搜索用户;其中 Map 如下所示:
{
"account": "chen",
"phone": "",
"email": ""
}
5.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数量 | long |

6 更新接收警报
6.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/update/receiveAlert//
6.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| value | Path | 是否开启 | Yes | boolean |

6.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

7 更新时区
7.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/update/timezone/
7.2 请求参数
timezone:Asia/Shanghai
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| timezone | Params | 时区 | Yes | String |

7.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

8 更新角色
8.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/update/role//
8.2 请求参数
value:user,admin
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| value | Path | 角色 | Yes | String |

8.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

9 更新是否可以创建mongodb
9.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/update/createMongoDBAble//
9.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| value | Path | 是否开启 | Yes | boolean |

9.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

10 更新是否可以创建agentId权限
10.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/update/generateAgentIdAble//
10.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| value | Path | 是否开启 | Yes | boolean |

10.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

11 更新用户资源信息
11.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/update/userResourceInfo////
11.2 请求参数
value:read,write,null
type:mongodb,host
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| objectId | Path | 根据type类型提供id | Yes | String |
| type | Path | 类型 | Yes | String |
| value | Path | 权限 | Yes | String |

11.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

12 删除用户
12.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/delete/user/
12.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |

12.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

13 获取用户资源
13.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/getUserResource/
13.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |

13.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | JSON |

{
"code": 1000,
"data": {
"id": "62eb99cdca0e230d4a13c423",
"createTime": 1659607501509,
"updateTime": 1660121964509,
"createMongoDBAble": true,
"generateAgentIdAble": true,
"mongoDBClusterList": [
{
"id": "62eb915e32f3671236d6a0be",
"competence": "write"
},
{
"id": "62ec7ac2ca0e230d4a13c490",
"competence": "write"
}
],
"hostList": [
{
"id": "62ecaf96ca0e230d4a13c75f",
"competence": "write"
},
{
"id": "62ecb027ca0e230d4a13c764",
"competence": "write"
}
]
}
}
14 获取用户服务数据
14.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/getUserServerResourceData////
14.2 请求参数
competence:write,read,null
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| competence | Path | 权限 | Yes | String |
| pageSize | Path | 每页大小 | Yes | int |
| pageIndex | Path | 第几页 | Yes | int |
| hostName | Params | 主机名称 | No | String |

14.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | List |

{
"code": 1000,
"data": [
{
"_id": "62eb906a32f3671236d6a0af",
"hostName": "server121",
"osVersion": "CentOS Linux release 7.7.1908 (Core)"
},
{
"_id": "62eb90ea32f3671236d6a0b7",
"hostName": "server90",
"osVersion": "CentOS Linux release 7.7.1908 (Core)"
}
]
}
15 获取用户服务数
15.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/getUserServerResourceCount//
15.2 请求参数
competence:write,read,null
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| competence | Path | 权限 | Yes | String |

15.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数量 | long |

16 获取用户mongoDB集群资源数据
16.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/getUserMongoDBClusterResourceData////
16.2 请求参数
competence:write,read,null
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| competence | Path | 权限 | Yes | String |
| pageSize | Path | 每页大小 | Yes | int |
| pageIndex | Path | 第几页 | Yes | int |
| clusterName | Params | 集群名称 | No | String |

16.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data.clusterName | 集群名称 | String |
| data.type | 类型:单节点,复制集,分片,纳管 | String |

17 获取用户mongoDB集群数
17.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/getUserMongoDBClusterResourceCount//
17.2 请求参数
competence:write,read,null
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| competence | Path | 权限 | Yes | String |
| clusterName | Params | 集群名称 | No | String |

17.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数量 | long |

18 获取信息数据
18.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/getMessageData//
18.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| pageSize | Path | 每页大小 | Yes | int |
| pageIndex | Path | 第几页 | Yes | int |
| operatorName | Params | 操作者名称 | No | String |
| objectName | Params | 被操作的对象名称 | No | String |
| status | Params | 状态 | No | boolean |
| message | Params | 消息 | No | String |
| startTime | Params | 开始时间 | No | long |
| endTime | Params | 结束时间 | No | long |

18.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | List |

{
"code": 1000,
"data": [
{
"id": "62fb00088e34f36c92fb013d",
"createTime": 1660616712771,
"updateTime": 1660616712771,
"message": "主机:server190已宕机\r\n\t告警时间UTC:2022-08-16 02:22:56",
"type": "alert",
"objectId": "62f343406ccc6972abb87818",
"objectName": "server190",
"operatorId": null,
"operatorName": null,
"eventId": null,
"list": []
}
]
}
19 获取消息数量
19.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/getMessageCount
19.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| operatorName | Params | 操作者名称 | No | String |
| objectName | Params | 被操作的对象名称 | No | String |
| status | Params | 状态 | No | boolean |
| message | Params | 消息 | No | String |
| startTime | Params | 开始时间 | No | long |
| endTime | Params | 结束时间 | No | long |

19.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数量 | long |

20 更新消息状态
20.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/update/messageStatus//
20.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |
| messageId | Path | 消息id | Yes | String |

20.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

21 更新所有消息状态
21.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/update/allMessageStatus/
21.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |

21.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| msg | 返回消息 | String |

22 获取所有成员id与名称
22.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/getAllMemberIdAndName
22.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberName | Params | 用户名称 | Yes | String |

22.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | List |
{
"code": 1000,
"data": [
{
"id": "63031cb149d5ad2d50af5d15",
"name": "admin"
},
{
"id": "630321262ef5221f75e9f0c6",
"name": "chen"
}
]
}
23 获取所有成员id与名称
23.1 请求路径
GET: http://{Server-Host}:{端口}/api/server/member/resetPassword/
23.2 请求参数
| Name | Located in | Description | Required | Schema |
|---|---|---|---|---|
| memberId | Path | 用户id | Yes | String |

23.3 返回结果
| Description | Schema | |
|---|---|---|
| code | 状态符:1000成功,其余异常 | int |
| data | 返回数据 | List |
