文档首页/ 测试计划 CodeArts TestPlan/ API参考/ API/ 自定义测试服务用例管理/ 新增自定义过滤器 - addCustomizedFilterUsingPOST
更新时间:2025-12-27 GMT+08:00
分享

新增自定义过滤器 - addCustomizedFilterUsingPOST

功能介绍

新增自定义过滤器

调用方法

请参见如何调用API

URI

POST /v4/projects/{project_uuid}/filters

表1 路径参数

参数

是否必选

参数类型

描述

project_uuid

String

项目UUID,项目唯一标识,固定长度32位字符(字母和数字)。获取方式请参见获取项目ID

请求参数

表2 请求Body参数

参数

是否必选

参数类型

描述

name

String

自定义过滤器名称

service_type

Integer

参数解释:

服务类型

约束限制:

不涉及

取值范围:

  • -1,全量用例。

  • 0,手工测试。

  • 1,接口自动化。

  • 7,功能自动化。

  • 8,WebUI自动化。

  • 100,自定义自动化(工厂)。

  • 11,性能自动化。

默认取值:

不涉及

stage_type

Integer

阶段过程(2:测试设计,3:测试执行,4:质量报告)

filter_content_info

FilterContentInfo object

过滤信息

表3 FilterContentInfo

参数

是否必选

参数类型

描述

status

Array of strings

参数解释:

状态

取值范围:

  • -1,删除。

  • 0,新建。

  • 5,设计中。

  • 6,测试中。

  • 7,完成。

  • -2,未设置。

默认取值:

不涉及

ranks

Array of strings

级别

results

Array of strings

结果

executors

Array of strings

执行者

owner_ids

Array of strings

处理者ID

module_ids

Array of strings

归属模块

issue_id

String

需求编号

creator_ids

Array of strings

创建者

release_ids

Array of strings

归属迭代

start_time

String

创建开始时间

end_time

String

创建结束时间

is_dissociation_case

String

是否关联需求

label_name_list

Array of strings

标签

execute_start_time

String

执行开始时间

execute_end_time

String

执行结束时间

is_keyword

Array of strings

关键字

test_types

Array of strings

类型

custom_field_filter

Map<String,Array<String>>

自定义字段过滤

review_status

Array of strings

参数解释:

用例评审状态

取值范围:

  • 0,未评审。

  • 1,已评审。

默认取值:

不涉及

响应参数

状态码:200

表4 响应Body参数

参数

参数类型

描述

value

CustomizedFilterVo object

请求返回的数据

表5 CustomizedFilterVo

参数

参数类型

描述

uri

String

自定义过滤器URI

name

String

自定义过滤器名称

filter

String

过滤器内容

updator

String

更新人

region

String

逻辑Region

service_type

Integer

参数解释:

服务类型

取值范围:

  • -1,全量用例。

  • 0,手工测试。

  • 1,接口自动化。

  • 7,功能自动化。

  • 8,WebUI自动化。

  • 100,自定义自动化(工厂)。

  • 11,性能自动化。

stage_type

Integer

阶段过程(2:测试设计,3:测试执行,4:质量报告)

user_id

String

用户ID

creator

String

创建人

create_time

String

创建时间

create_time_timestamp

Long

创建时间时间戳

update_time

String

更新时间

update_time_timestamp

Long

更新时间时间戳

project_uuid

String

项目UUID,项目唯一标识,固定长度32位字符(字母和数字)。获取方式请参见获取项目ID

状态码:400

表6 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:

接口调用失败错误码

取值范围:

不涉及

error_msg

String

参数解释:

接口调用失败错误信息

取值范围:

不涉及

状态码:401

表7 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:

接口调用失败错误码

取值范围:

不涉及

error_msg

String

参数解释:

接口调用失败错误信息

取值范围:

不涉及

状态码:404

表8 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:

接口调用失败错误码

取值范围:

不涉及

error_msg

String

参数解释:

接口调用失败错误信息

取值范围:

不涉及

状态码:500

表9 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:

接口调用失败错误码

取值范围:

不涉及

error_msg

String

参数解释:

接口调用失败错误信息

取值范围:

不涉及

请求示例

新增自定义过滤器

post https://{endpoint}/v4/projects/3d2378e0fc504c638f48b21377d6add1/filters

{
  "filter_content_info" : {
    "results" : [ 0 ]
  },
  "name" : "未执行用例",
  "service_type" : -1,
  "stage_type" : "2"
}

响应示例

状态码:200

OK

{
  "value" : {
    "uri" : "v90100010scllj9h",
    "name" : "未执行用例",
    "filter" : "{\"results\":[\"0\"]}",
    "updator" : "da48b09775884920a3745ccbd4a66f1e",
    "region" : "roma-guian-2",
    "service_type" : -1,
    "stage_type" : 2,
    "user_id" : "da48b09775884920a3745ccbd4a66f1e",
    "creator" : "da48b09775884920a3745ccbd4a66f1e",
    "project_uuid" : "1b7179edc79a431f9711434124ac9f28"
  }
}

状态码

状态码

描述

200

OK

400

Bad Request

401

Unauthorized

404

Not Found

500

Internal Server Error

错误码

请参见错误码

相关文档