文档首页/ 需求管理 CodeArts Req/ API参考/ API/ 项目信息/ 创建或更新工作项模板
更新时间:2025-08-25 GMT+08:00

创建或更新工作项模板

功能介绍

创建或更新工作项模板。

调用方法

请参见如何调用API

URI

POST /v2/project/templates

请求参数

表1 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释:

用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。

约束限制:

必传。

取值范围:

最小长度:10,最大长度:32768。

默认取值:

不涉及。

表2 请求Body参数

参数

是否必选

参数类型

描述

projectUUId

String

参数解释

项目的32位uuid,项目唯一标识,通过查询项目列表接口获取,响应消息体中的project_id字段的值就是项目ID。

约束限制

正则表达式,[A-Za-z0-9]{32}。

取值范围:

不涉及。

默认取值

不涉及。

description

String

参数解释:

工作项详情模板描述内容。

约束限制:

字符最小长度:0,字符最大长度:65535。

取值范围:

不涉及。

默认取值:

不涉及。

trackerId

Integer

参数解释:

工作项类型id。

约束限制:

不涉及。

取值范围:

2(任务/Task)

3(缺陷/Bug)

5(Epic)

6(Feature)

7(Story)

默认取值:

不涉及。

issueFieldConfigs

Array of IssueFieldConfig objects

参数解释:

字段配置信息。

约束限制:

不涉及。

表3 IssueFieldConfig

参数

是否必选

参数类型

描述

field

String

参数解释:

字段名称。

约束限制:

只能包含汉字、英文大小写字母、数字、下划线和连字符。

取值范围:

不涉及。

默认取值:

不涉及。

is_required

Integer

参数解释:

字段是否必填。

约束限制:

不涉及。

取值范围:

0(非必填)

1(必填)

默认取值:

不涉及。

default_value

String

参数解释:

字段默认值。

约束限制:

正则表达式,[\s\S]{1,1000}。

取值范围:

不涉及。

默认取值:

不涉及。

position

Integer

参数解释:

字段优先级顺序。

约束限制:

正则表达式,[0-9]{1,10}。

取值范围:

不涉及。

默认取值:

不涉及。

响应参数

状态码:200

接口成功响应。

请求示例

POST https://{endpoint}/v2/project/templates

{
  "description" : "<p style=\"padding-top: 5.0px;\"><span style=\"font-weight: bold;\"> 作为 </span><用户角色></p><p><br></p><p style=\"padding-top: 5.0px;\"><span style=\"font-weight: bold;\"> 我想要 </span><结果></p><p><br></p><p style=\"padding-top: 5.0px;\"><span style=\"font-weight: bold;\"> 以便于 </span><目的>&nbsp;</p>",
  "projectUUId" : "816e5f0877544de58010157fc30da3e7",
  "trackerId" : "7",
  "issueFieldConfigs" : [ {
    "field" : "status_id",
    "is_required" : 2,
    "default_value" : "新建",
    "position" : 1
  }, {
    "field" : "assigned_to_id",
    "is_required" : 2,
    "default_value" : "自己",
    "position" : 2
  }, {
    "field" : "module_id",
    "is_required" : 1,
    "default_value" : "",
    "position" : 3,
    "is_visible" : true
  }, {
    "field" : "fixed_version_id",
    "is_required" : 0,
    "default_value" : "",
    "position" : 4
  }, {
    "field" : "start_date",
    "is_required" : 0,
    "default_value" : "",
    "position" : 5
  }, {
    "field" : "due_date",
    "is_required" : 0,
    "default_value" : "",
    "position" : 6
  }, {
    "field" : "order",
    "is_required" : 0,
    "default_value" : "1",
    "position" : 7
  }, {
    "field" : "priority_id",
    "is_required" : 2,
    "default_value" : "中",
    "position" : 8
  }, {
    "field" : "severity_id",
    "is_required" : 2,
    "default_value" : "一般",
    "position" : 9
  }, {
    "field" : "assigned_cc",
    "is_required" : 0,
    "default_value" : "",
    "position" : 10
  }, {
    "field" : "parent_issue_id",
    "is_required" : 0,
    "default_value" : "",
    "position" : 11
  }, {
    "field" : "domain_id",
    "is_required" : 0,
    "default_value" : "",
    "position" : 12
  }, {
    "field" : "more",
    "is_required" : 0,
    "default_value" : "",
    "position" : 13
  }, {
    "field" : "releaseDev",
    "is_required" : 0,
    "default_value" : "",
    "position" : 14
  }, {
    "field" : "developer",
    "is_required" : 0,
    "default_value" : "",
    "position" : 15
  }, {
    "field" : "expected_work_hours",
    "is_required" : 0,
    "default_value" : "0",
    "position" : 16
  }, {
    "field" : "actual_work_hours",
    "is_required" : 0,
    "default_value" : "",
    "position" : 17
  }, {
    "field" : "done_ratio",
    "is_required" : 0,
    "default_value" : "",
    "position" : 18
  }, {
    "field" : "story_point_id",
    "is_required" : 0,
    "default_value" : "1",
    "position" : 19
  }, {
    "field" : "custom_field18",
    "is_required" : 0,
    "default_value" : "",
    "position" : 20
  } ]
}

响应示例

状态码:200

接口成功响应。

{
  "result" : { },
  "status" : "success"
}

状态码

状态码

描述

200

接口成功响应。

错误码

请参见错误码