API 参考文档
云哨兵开放 API · 所有接口需携带 JWT Token
认证方式
成功获取
成功获取
token,后续请求在 Header 中携带:
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
须知
令牌有效期 30 天,过期需重新获取。
请勿短时间内频繁调用JWT认证接口重复获取令牌,以免触发 IP 限流策略。正常使用按需获取token即可。
所有接口(认证接口除外)均需认证。
限制
为保障服务稳定性与有限资源的合理使用,开放 API 调用受以下策略约束:
频率限制 同一接口 10 秒内仅允许 1 次调用
月度配额 免费用户1,000 次 · 付费用户 10,000 次 · 会员用户 50,000 次
安全策略 控制台需配置 IP 或域名白名单,仅白名单内来源可调用 API
月度配额 免费用户1,000 次 · 付费用户 10,000 次 · 会员用户 50,000 次
安全策略 控制台需配置 IP 或域名白名单,仅白名单内来源可调用 API
超出频率限制返回 429,超出月度配额返回 403。配额按月重置,控制台可查看剩余用量。
用户认证
POST
/User/token
JWT认证获取token
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| openId | string | 是 | 用户唯一标识 |
| password | string | 是 | 密码 |
请求示例
{
"openId": "zhangsan_001",
"password": "123456"
}
响应示例
{
"success": true,
"token": "eyJhbGciOiJIUzI1NiIs...",
"nickName": "张三",
"openId": "zhangsan_001",
"userEmail": "zhangsan@example.com",
"createTime": "2026-01-01T00:00:00"
}
GET
/User/quota
查询配额与会员信息
响应示例
{
"totalQuota": 51,
"usedQuota": 3,
"isAdvanced": true,
"advancedExpireTime": "2026-12-31T23:59:59",
"expireTime": "2026-12-31T23:59:59",
"subPlan": 0,
"createTime": "2026-01-01T00:00:00"
}
字段说明
| 字段 | 说明 |
|---|---|
| totalQuota | 总配额(任务数上限) |
| usedQuota | 已用配额 |
| isAdvanced | 是否会员 |
| advancedExpireTime | 会员到期时间 |
| expireTime | 配额到期时间 |
PUT
/User/profile
修改用户资料
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| nickName | string | 否 | 新昵称 |
| string | 否 | 新邮箱 |
请求示例
{
"nickName": "新昵称",
"Email": "newemail@example.com"
}
响应示例
{
"success": true,
"nickName": "新昵称",
"email": "newemail@example.com"
}
监控任务
GET
/ApiMonitor/tasks
查询任务列表
响应示例
[
{
"id": 2005,
"name": "百度首页",
"url": "www.baidu.com",
"method": "GET",
"intervalSeconds": 3600,
"expectedStatusCode": 200,
"timeoutSeconds": 30,
"isActive": true,
"lastStatus": true,
"lastCheckTime": "2026-07-15T09:13:13.6519205",
"monitorType": 1,
"executionMode": 0
}
]
monitorType 说明
| 值 | 说明 |
|---|---|
| 1 | API 监控 |
| 2 | 网站内容监控 |
| 3 | 端口监控 |
| 4 | SSL 证书监控 |
| 5 | 业务流程监控 |
executionMode 说明
| 值 | 说明 |
|---|---|
| 0 | 平台执行 |
| 1 | 客户端执行 |
POST
/ApiMonitor/tasks
创建监控任务
通用参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| name | string | 是 | 任务名称 |
| url | string | 是 | 监控地址 |
| monitorType | int | 是 | 1-5(见上表) |
| intervalSeconds | int | 否 | 间隔(秒),默认推荐值 |
| timeoutSeconds | int | 否 | 超时(秒),默认30 |
| expectedStatusCode | int | 否 | 期望状态码,默认200 |
| isActive | bool | 否 | 是否启用,默认true |
| executionMode | int | 否 | 0=平台,1=客户端,默认0 |
| method | string | 否 | GET/POST/PUT/DELETE,默认GET |
类型特有参数
| monitorType | 特有字段 | 说明 |
|---|---|---|
| 2(网站) | expectedKeywords | 关键词,多个用逗号分隔 |
| 2(网站) | matchAllKeywords | 是否全部匹配,默认true |
| 2(网站) | checkContentExists | 是否检查存在,默认true |
| 3(端口) | port | 端口号(必填) |
| 4(SSL) | preAlertDays | 提前提醒天数,默认30 |
| 5(业务流程) | flowStepsJson | 步骤配置JSON(必填) |
请求示例(API监控)
{
"name": "API健康检查",
"url": "https://api.example.com/health",
"monitorType": 1,
"method": "GET",
"intervalSeconds": 600,
"timeoutSeconds": 30,
"expectedStatusCode": 200
}
响应示例
{
"id": 3005,
"message": "创建成功"
}
PUT
/ApiMonitor/tasks/{taskId}
更新监控任务
路径参数
| 字段 | 类型 | 说明 |
|---|---|---|
| taskId | int | 任务ID |
请求体
{
"name": "新名称",
"url": "https://new.example.com"
// 只传需要修改的字段即可
}
DELETE
/ApiMonitor/tasks/{taskId}
删除监控任务
路径参数
| 字段 | 类型 | 说明 |
|---|---|---|
| taskId | int | 任务ID |
POST
/ApiMonitor/tasks/{taskId}/enable
启用任务
路径参数
| 字段 | 类型 | 说明 |
|---|---|---|
| taskId | int | 任务ID |
响应示例
{
"message": "启用成功"
}
POST
/ApiMonitor/tasks/{taskId}/probe
立即探测(手动触发)
路径参数
| 字段 | 类型 | 说明 |
|---|---|---|
| taskId | int | 任务ID |
频率限制
同一任务 60 秒内仅允许探测一次。
响应示例
{
"success": true,
"errorMessage": null
}
POST
/ApiMonitor/tasks/batch
批量操作
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| taskIds | int[] | 是 | 任务ID数组 |
| action | string | 是 | enable / disable / delete |
请求示例
{
"taskIds": [2005, 2006],
"action": "enable"
}
统计数据
GET
/ApiMonitor/overall-sla
最近7天整体可用率
响应示例
{
"totalChecks": 200,
"successChecks": 197,
"sla": 98.5
}
字段说明
| 字段 | 说明 |
|---|---|
| totalChecks | 总检测次数 |
| successChecks | 成功次数 |
| sla | 可用率百分比 |
GET
/ApiMonitor/daily-check-count
每日检测次数统计
查询参数
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
| days | int | 7 | 查询天数 |
响应示例
[
{ "date": "2026-07-09", "count": 198 },
{ "date": "2026-07-10", "count": 210 }
]
GET
/ApiMonitor/overall-response-time-history
响应时间趋势
查询参数
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
| days | int | 7 | 查询天数 |
响应示例
[
{ "date": "2026-07-09", "avgResponseTime": 52.5, "maxResponseTime": 129 },
{ "date": "2026-07-10", "avgResponseTime": 64.3, "maxResponseTime": 191 }
]
监控日志
GET
/MonitorLog/successRate
成功率趋势
查询参数
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
| days | int | 7 | 查询天数 |
响应示例
[
{ "date": "2026-07-09", "rate": 98.5 },
{ "date": "2026-07-10", "rate": 97.2 }
]
GET
/MonitorLog/recent
最近告警
查询参数
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
| count | int | 5 | 获取条数 |
响应示例
[
{
"taskName": "百度首页",
"time": "2026-07-15T09:13:13",
"error": "连接超时"
}
]
GET
/MonitorLog/report
下载周报/月报
查询参数
| 字段 | 类型 | 默认 | 说明 |
|---|---|---|---|
| type | string | weekly | weekly / monthly |
| useAi | bool | true | 是否使用AI摘要 |
响应
返回 Word 文档(.doc)二进制流,浏览器自动下载。
通知渠道
GET
/NotifyChannel
查询通知渠道列表
响应示例
[
{
"id": 10,
"channelType": "DingTalk",
"webhookUrl": "https://oapi.dingtalk.com/robot/send?access_token=xxx",
"isActive": true
}
]
channelType 说明
| 值 | 说明 |
|---|---|
| 邮箱 | |
| DingTalk | 钉钉 |
| WeWork | 企业微信 |
| Feishu | 飞书 |
POST
/NotifyChannel
添加通知渠道
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| channelType | string | 是 | Email / DingTalk / WeWork / Feishu |
| string | 条件 | Email类型必填 | |
| webhookUrl | string | 条件 | 钉钉/企微/飞书必填 |
| isActive | bool | 否 | 是否启用,默认true |
请求示例(钉钉)
{
"channelType": "DingTalk",
"webhookUrl": "https://oapi.dingtalk.com/robot/send?access_token=xxx",
"isActive": true
}
PUT
/NotifyChannel/{channelId}
切换渠道启用状态
路径参数
| 字段 | 类型 | 说明 |
|---|---|---|
| channelId | int | 渠道ID |
请求体
{
"isActive": false
}
DELETE
/NotifyChannel/{channelId}
删除通知渠道
路径参数
| 字段 | 类型 | 说明 |
|---|---|---|
| channelId | int | 渠道ID |
本地性能
POST
/machine/report
上报本地性能数据
请求参数
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
| token | string | 是 | 用户标识(OpenId) |
| machineName | string | 是 | 设备名称或IP |
| cpu | float | 是 | CPU使用率(百分比) |
| memory | float | 是 | 内存使用率(百分比) |
| disk | float | 是 | 磁盘使用率(百分比) |
请求示例
{
"token": "your-openid",
"machineName": "192.168.1.100",
"cpu": 45.2,
"memory": 62.8,
"disk": 71.5
}
响应示例
{
"code": 0,
"message": "上报成功"
}
说明
该接口用于客户端上报本地性能数据,多个设备共用同一账户时,通过 machineName 区分。
云哨兵监控平台 · 文档版本 V1.0 · 接口如有变更以最新为准 · 测试工具