只读 API
筛选选项
在读取分析数据前,获取项目支持的筛选值。
GET
/api/domains/{host}/scope-options接口#
GET /api/domains/{host}/scope-options
使用个人 Bearer 令牌进行身份验证。域名必须属于账号可访问的项目。
请求示例#
curl --fail-with-body 'https://app.keptai.com/api/domains/example.com/scope-options' \
-H "Authorization: Bearer $KEPT_API_TOKEN"
const response = await fetch(
'https://app.keptai.com/api/domains/example.com/scope-options',
{ headers: { Authorization: `Bearer ${process.env.KEPT_API_TOKEN}` } }
);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const data = await response.json();
console.log(data);
import json, os, urllib.request
request = urllib.request.Request(
'https://app.keptai.com/api/domains/example.com/scope-options',
headers={'Authorization': 'Bearer ' + os.environ['KEPT_API_TOKEN']}
)
with urllib.request.urlopen(request) as response:
print(json.load(response))
响应字段#
| 字段 | 内容 |
|---|---|
| engines | id、label、configured、lastRunDay |
| topics | topic 与 count |
| categories | category 与 count |
| brands | name、tracked,适用时包含 own |
| ownTerms | 归一化的自有品牌词 |
| days | 7、30、90 |
应用筛选值#
在 agent-analytics 请求中使用返回的值。engine、topic、category、brand 可使用逗号分隔多个值。构造 URL 时请对参数值编码。用户画像不是提示词属性,不能用于筛选。
可选参数 refresh=1 请求刷新筛选选项。读取失败可能返回 502。域名和权限相关错误请参考身份验证。