查询告警标签¶
通过以下步骤查询告警标签,该接口可返回团队内所有可用标签
示例¶
请求cURl:
curl --location --request GET 'https://caweb.aiops.com/api/alert/rest/api/v1/labels' \ --user 'email@example.com:<access_token>' \ --header 'Accept: application/json'
access_token如何获取请参考文档 api令牌
提示
• 示例邮箱应替换为用户注册所用邮箱
• access_token应替换为您手动获取的access_token
• 如需对请求进行加密处理:请将
--user 'email@example.com:access_token' \
--header 'Accept: application/json'
替换为:
--header 'Authorization: Basic Z2FveWluaW5nOTk5NUAxNjMuY29tOmt1WWl6bmljZ3oxN0JBVjk=' \
--header 'Content-Type: application/json'
• 替换步骤请参考加密步骤
返回参数¶
| 参数 | 类型 | 说明 |
|---|---|---|
| result | string | 返回结果:success成功 、false 失败 |
| message | string | 返回消息 |
| data | 返回数据集 | |
| totalCount | int | 数据量 |
| code | int | 响应码 |
data结果集¶
| 参数 | 类型 | 说明 |
|---|---|---|
| id | string | 标签 id |
| level | int | 标签等级 |
| key | string | 标签名 |
| integration | string | 接入类型 |
| app | string | 具体应用 |
| field | string | 数据字段 |
| value | string | 标签默认值 |
| inner | int | 是否内置标签 |
响应报文¶
{
"result":"success",
"message":"ok",
"data":[
{
"id":"00000000-0000-0000-0000-000000000000",
"level":0,
"integration":null,
"app":null,
"field":"alarm_name",
"key":"alarmName",
"value":null,
"description":"告警标题",
"remark":"告警标题",
"inner":1,
"owner":null,
"createTime":null,
"updateTime":null,
"status":"ACTIVE",
" deleted":0,
"available":1,
"appName":null
}
],
"totalCount":1,
"code":200
}
错误响应码¶
| 错误码 | 说明 |
|---|---|
| 200 | 成功 |
| 400 | 失败,传入的参数有问题 |
| 401 | 认证失败,用户名密码错误 |