# 说明

创建自定义字段

# url

https://apiv2.tapd.tencent.com/custom_field_configs

# 支持格式

JSON/XML(默认JSON格式)

# HTTP请求方式

POST

# 请求数限制

  • 不能超过自定义字段的最大个数
  • 选项个数不能超过 500

# 请求参数

字段名 必选 类型及范围 说明 特殊规则
workspace_id integer 空间ID
entry_type string 新增字段分类 story
name string 字段名称
type string 字段类型 select 单选下拉列表、text 单行文本框、checkbox 多选下拉、 user_chooser 人名输入框、dateinput 日期、datetime 日期时间、float 浮点数、integer 整数、 link 链接、 file 文件
memo string 字段备注
option string 字段值选项 详细使用说明见下面

# 请求参数 option 详细说明

  1. 字段类型为 select、 checkbox 时为必填
  2. 字段类型为 select、 checkbox 时,选项参数格式如:AA|BB|CC 格式,使用“|”隔开

# 调用示例及返回结果

# 创建需求自定义字段配置

# curl 使用 Basic Auth 鉴权调用示例

curl -u 'api_user:api_password' -d 'entry_type=story&name=设计稿&type=file&workspace_id=69998996' 'https://apiv2.tapd.tencent.com/custom_field_configs'

# curl 使用 OAuth Access Token 鉴权调用示例

curl -H 'Authorization: Bearer ACCESS_TOKEN' 'entry_type=story&name=设计稿&type=file&workspace_id=69998996' 'https://apiv2.tapd.tencent.com/custom_field_configs'

# 返回结果

{
    "status": 1,
    "data": {
        "CustomFieldConfig": {
            "id": "1069998996215242279",
            "workspace_id": "69998996",
            "app_id": "1",
            "entry_type": "story",
            "custom_field": "custom_field_six",
            "type": "file",
            "name": "设计稿",
            "options": "[]",
            "extra_config": null,
            "enabled": "1",
            "creator": "",
            "created": "2024-11-26 11:33:03",
            "modified": "2024-11-26 11:33:03",
            "freeze": "0",
            "sort": null,
            "memo": "",
            "open_extension_id": ""
        }
    },
    "info": "success"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# 创建checkbox自定义字段配置

# curl 使用 Basic Auth 鉴权调用示例

curl -u 'api_user:api_password' -d 'entry_type=story&name=工作项类型&type=checkbox&option=需求|缺陷|工作项&workspace_id=69998996' 'https://apiv2.tapd.tencent.com/custom_field_configs'

# curl 使用 OAuth Access Token 鉴权调用示例

curl -H 'Authorization: Bearer ACCESS_TOKEN' -d 'entry_type=story&name=工作项类型&type=checkbox&option=需求|缺陷|工作项&workspace_id=69998996' 'https://apiv2.tapd.tencent.com/custom_field_configs'

# 返回结果

{
    "status": 1,
    "data": {
        "CustomFieldConfig": {
            "id": "1069998996215242281",
            "workspace_id": "69998996",
            "app_id": "1",
            "entry_type": "story",
            "custom_field": "custom_field_seven",
            "type": "checkbox",
            "name": "工作项类型",
            "options":"{\"1\":\"\需\求\",\"2\":\"\缺\陷\",\"3\":\"\工\作\项\"}",
            "extra_config":"{\"color_config\":[{\"color\":\"transparent\",\"value\":\"\需\求\"},{\"color\":\"transparent\",\"value\":\"\缺\陷\"},{\"color\":\"transparent\",\"value\":\"\工\作\项\"}]}",
            "enabled": "1",
            "creator": "",
            "created": "2024-11-26 12:53:52",
            "modified": "2024-11-26 12:53:52",
            "freeze": "0",
            "sort": null,
            "memo": "",
            "open_extension_id": ""
        }
    },
    "info": "success"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

# 返回字段说明

字段 说明
id 自定义字段配置的ID
workspace_id 所属项目ID
entry_type 所属实体对象(story)
name 自定义字段名称
type 输入字段类型
enabled 是否启用
memo 自定义字段显示备注
custom_field 自定义字段预留个数名称
options 自定义字段可选值
extra_config 自定义字段其他配置(颜色、单位)
created 创建时间
modified 最后修改时间
sort 显示时排序系数
上次更新: 2024-11-26 13:13:35