API调用
1. 创建/更新名单条目接口
接口名称
api_create_sys_name_list_item
功能描述
创建或更新一个名单条目。如果名单条目已存在则更新,不存在则创建。
请求方法
POST
请求参数
参数名 | 类型 | 必填 | 描述 |
---|---|---|---|
wtds_auth | string | 是 | WebTDS控制台认证令牌 |
name_list_name | string | 是 | 名单名称 |
name_list_item | string | 是 | 名单条目 |
请求示例
{
"wtds_auth": "user_auth_token",
"name_list_name": "black_list",
"name_list_item": "example.com"
}
响应参数
参数名 | 类型 | 描述 |
---|---|---|
result | boolean | 操作结果 |
message | string | 成功或失败消息 |
成功响应示例
{
"result": true,
"message": "create success"
}
失败响应示例
{
"result": false,
"message": "name_list_name is not exist"
}
2. 获取名单条目列表接口
接口名称
api_get_sys_name_list_item_list_all
功能描述
获取指定名单下的所有名单项
请求方法
POST
请求参数
参数名 | 类型 | 必填 | 描述 |
---|---|---|---|
wtds_auth | string | 是 | WebTDS控制台认证令牌 |
name_list_name | string | 是 | 名单名称 |
请求示例
{
"wtds_auth": "user_auth_token",
"name_list_name": "black_list"
}
响应参数
参数名 | 类型 | 描述 |
---|---|---|
records | array | 名单条目记录列表 |
result | boolean | 操作结果 |
成功响应示例
{
"records": [
{
"user_name": "test_user",
"name_list_name": "black_list",
"name_list_item": "example.com",
"name_list_expire": "true",
"name_list_item_expire_time": 1672502400
},
{
"user_name": "test_user",
"name_list_name": "black_list",
"name_list_item": "test.com",
"name_list_expire": "false",
"name_list_item_expire_time": 0
}
],
"result": true
}
失败响应示例
{
"result": false,
"message": "Database query error"
}
数据结构说明
名单项(sys_name_list_item)表结构
字段名 | 类型 | 描述 |
---|---|---|
user_name | string | 用户名 |
name_list_name | string | 名单名称 |
name_list_item | string | 名单项内容 |
name_list_expire | string | 是否过期("true"/"false") |
name_list_item_expire_time | integer | 过期时间戳(0表示永不过期) |