添加检索模板
最近更新时间: 2026-09-17 00:02:46
1. 接口描述
接口请求域名: cwp.api3.fincloud.tencent.cn。
添加检索模板
默认接口请求频率限制:20次/秒。
接口更新时间:2023-02-09 16:57:33。
接口既验签名又鉴权。
2. 输入参数
以下请求参数列表仅列出了接口请求参数和部分公共参数,完整公共参数列表见公共请求参数。
| 参数名称 | 必选 | 允许NULL | 类型 | 描述 |
|---|---|---|---|---|
| Action | 是 | 否 | String | 公共参数,本接口取值:CreateSearchTemplate |
| Version | 是 | 否 | String | 公共参数,本接口取值:2018-02-28 |
| Region | 是 | 否 | String | 公共参数,地域信息本接口不需要传递此参数。 |
| SearchTemplate | 是 | 否 | SearchTemplate | 搜索模板 示例值:查看 |
3. 输出参数
| 参数名称 | 类型 | 描述 |
|---|---|---|
| Message | String | 失败原因 示例值: A record with the same name already exists |
| Status | Uint64 | 0:成功,非0:失败 示例值: 0 |
| RequestId | String | 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 |
4. 错误码
以下仅列出了接口业务逻辑相关的错误码,其他错误码详见公共错误码。
| 错误码 | 描述 |
|---|---|
| InternalError | 内部错误。 |
| InvalidParameter.ParsingError | 参数解析错误。 |
| MissingParameter | 缺少参数错误。 |
| InvalidParameter | 参数错误。 |
| InvalidParameterValue | 参数取值错误。 |
| InvalidParameter.NameHasRepetition | 名字已重复。 |
5. 示例
示例1 添加检索模板
输入示例
https://cwp.api3.fincloud.tencent.cn/?Action=CreateSearchTemplate
&SearchTemplate.Name="kbtest"
&SearchTemplate.LogType="malware"
&SearchTemplate.Condition="src_ip match:10.0.0.1"
&SearchTemplate.TimeRange="2020-06-13 00:00:00 to 2020-07-13 23:59:59"
&SearchTemplate.Query="{\"index\":[\"malware\"],\"body\":{\"query\":{\"bool\":{\"filter\":{\"bool\":{\"filter\":{\"range\":{\"timestamp\":{\"gte\":1591977600000,\"lte\":1594655999999}}},\"must\":[{\"term\":{\"src_ip\":\"10.0.0.1\"}}],\"must_not\":[],\"should\":[]}}}},\"aggs\":{\"count_stats\":{\"date_histogram\":{\"field\":\"timestamp\",\"interval\":\"12h\",\"time_zone\":\"Asia/city1\",\"min_doc_count\":1}}},\"highlight\":{\"fields\":{\"*\":{}}}},\"sort\":[{\"timestamp\":\"desc\"}]}"
&SearchTemplate.Flag="simple"
&SearchTemplate.DisplayData="[{\"id\":449375484687,\"patternsField\":\"src_ip\",\"selectedtype\":\"is\",\"selectedOptionsMap\":{\"is\":\"a1\",\"like\":\"b1\",\"not\":\"c1\",\"is_one_of\":\"d1\",\"not_one_of\":\"e1\"},\"selectedTypeList\":[\"is\",\"like\",\"not\",\"is_one_of\",\"not_one_of\"],\"third_cat\":\"input\",\"value\":\"10.0.0.1\"}]"
&<Public request parameters>
输出示例
{
"Response": {
"Status": 0,
"RequestId": "49082d4a-71b4-4e32-9ca1-b33872a4a63a"
}
}