POST - 创建内容检测器

介绍创建内容检测器的步骤。

接口介绍

在当前系统上创建内容检测器。

请求方式(HTTP/1.1)

POST

接口地址

https://UCSS_URL/qkact/v0/contentClassifier/

请求参数

参数名称 参数位置 是否必须 描述
Content-Type header application/json 定义网络文件的类型和网页的编码。
Authorization header Basic base64("client-id:access-token") base64加密的Http Basic认证。
Basic 加密串,如Basic dXNlcjp1c2Vy
注: client-id是客户端ID,access-token是在获取认证时返回的值。
User-Agent header QKAct-External-Client 检查浏览页面的访问者在用什么操作系统(包括版本号)浏览器(包括版本号)和用户个人偏好的代码。
POST请求Body - JSON字符串示例
{
    "content-classifier":[
        {
            "policy-id":"abcdef1-4567-11df-a475-0022647abcde",
            "custom":[
                {
                    "match-count":2,
                    "content":[
                        {
                            "value-type":"send-ip",
                            "value":"192.168.0.21",
                            "match-condition":"include",
                            "type":"keyword",
                            "exact-match":true
                        },
                        {
                            "value-type":"send-ip",
                            "value":"192.168.0.22",
                            "match-condition":"exclude",
                            "type":"keyword",
                            "exact-match":false
                        },
                        {
                            "value-type":"send-ip",
                            "value":"192.168.0.22",
                            "match-condition":"exclude",
                            "type":"regex"
                        }
                    ]
                }
            ]
        }
    ]
}
Body参数定义如下表所示:
参数名 说明
content-classifier 内容检测器。
id 来源。类型为array。
policy-id 策略ID(对应UCSS策略UUID)。类型为String。
custom 自定义检测器。
match-count 匹配个数。字段类型为number。
content 匹配规则
  • value-type
value-type可设置send-ip(发送IP地址)、from(发件人)、to(收件人)等值。参考以下章节查看详细参数列表:检测器Content的value-type参数说明
  • value
value-type的值。
  • match-condition
匹配条件。可设置为include(包含)、exclude(不包含)等值。参考以下章节查看详细参数列表:检测器Content的match-condition参数说明
  • type
类型包含以下两种:
  • keyword。关键字,并选择精确匹配条件,字段类型string。
  • regex。正则表达式,无需选择精确匹配条件,字段类型string。
  • exact-match
精确匹配。字段类型boolean。
  • headers
邮件头。当value-type值为header时可填写,为空表示全部邮件头。
  • unit
邮件大小单位。当value-typesize时可填写。值可设为:Byte、KB、MB

返回结果(创建成功的返回示例)

{
    "status":  0,
    "content-ids": [
        "ea12123-4567-11df-a475-0022647cdeab",
        "abcd123-4567-8910-a475-0022647abcde"
    ]
}

返回结果(创建失败的返回示例)

{
 "status": 1,
 "reason": "Not all Filters can be created",
 "failed-contents": [0,1]
}
返回值参数定义如下表所示:
参数名 说明
status 请求是否成功,成功为0,失败为1。
reason 状态解释。
content-ids 创建成功的检测器ID列表。
failed-contents 创建失败的检测器序号。