文档首页/ 需求管理 CodeArts Req/ API参考/ API/ IPD工作项管理/ 批量创建IPD项目工作项 - BatchCreateIpdIssues
更新时间:2026-10-22 GMT+08:00
分享

批量创建IPD项目工作项 - BatchCreateIpdIssues

功能介绍

批量创建IPD项目工作项。支持一次请求创建多个工作项,适用于批量导入子工作项、批量创建任务等场景。

调用方法

请参见如何调用API。

授权信息

当前API调用无需身份策略权限。

URI

POST /v1/ipdprojectservice/projects/{project_id}/issues/batch-create

表1 路径参数

参数

是否必选

参数类型

描述

project_id

是

String

参数解释:

项目的32位唯一标识ID,项目唯一标识。

通过查询项目列表获取,响应消息体中的id字段的值就是项目ID。

约束限制:

不涉及。

取值范围:

32个字符。

默认取值:

不涉及。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

是

String

参数解释:

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

约束限制:

不涉及。

取值范围:

10~32768个字符。

默认取值:

不涉及。

表3 请求Body参数

参数

是否必选

参数类型

描述

[数组元素]

是

Array of CreateIpdProjectIssueRequestBody objects

参数解释:

工作项创建模型。

约束限制:

不涉及。

表4 CreateIpdProjectIssueRequestBody

参数

是否必选

参数类型

描述

title

是

String

参数解释:

工作项标题。

约束限制:

不涉及。

取值范围:

2~256个字符。

默认取值:

不涉及。

description

是

String

参数解释:

工作项描述字段。

约束限制:

不涉及。

取值范围:

0~500000个字符。

默认取值:

不涉及。

status

否

String

参数解释:

工作项状态code。可通过查询工作项状态接口获取,响应消息体中的code字段的值就是工作项状态code。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

不涉及。

src_domain

否

String

参数解释:

工作项提出项目的项目空间ID。通过查询IPD项目列表获取,响应消息体中的domain_id字段的值就是项目空间ID。

约束限制:

32个字符,由英文字母和数字组成。

取值范围:

不涉及。

默认取值:

不涉及。

submitted_by

否

String

参数解释:

提交人ID。可通过查询项目成员列表接口获取,响应消息体中的id字段的值就是用户ID。

约束限制:

32个字符,由小写字母和数字组成。

取值范围:

不涉及。

默认取值:

domain_id

否

String

参数解释:

工作项归属项目的项目空间ID。通过查询IPD项目列表获取,响应消息体中的domain_id字段的值就是项目空间ID。

约束限制:

32个字符,由英文字母和数字组成。

取值范围:

不涉及。

默认取值:

不涉及。

recipient

否

Array of strings

参数解释:

承接人ID。可通过查询项目成员列表接口获取,响应消息体中的id字段的值就是用户ID。

约束限制:

32个字符,由小写字母和数字组成。

expect_delivery_time

否

Long

参数解释:

期望完成时间。

约束限制:

不涉及。

取值范围:

时间戳。

默认取值:

不涉及。

priority

否

String

参数解释:

优先级。用户通过查询字段列表接口获取,响应消息体中优先级的option字段的值就是优先级字段的可选值。

约束限制:

不涉及。

取值范围:

  • 低:低优先级。

  • 中:中优先级。

  • 高:高优先级。

默认取值:

不涉及。

assigned_cc

否

Array of strings

参数解释:

工作项抄送人ID,支持多个抄送人。

约束限制:

同一工作项最多支持50个抄送人。

category

是

String

参数解释:

工作项类型。编辑工作项时,此字段必填、值为当前工作项正确的工作项类型,但不会更新此字段。

约束限制:

不涉及。

取值范围:

支持多种工作项类型,使用英文逗号分隔。

  • 系统设备类项目:RR、SF、IR、SR、AR、Task、Bug

  • 独立软件类项目:RR、SF、IR、US、Task、Bug

  • 云服务类项目:RR、Epic、FE、US、Task、Bug

  • 自定义需求模型项目:通过获取模型树配置信息获取,根据响应消息体中categories字段中对象的icon字段确定工作项类型,code字段值即是工作项类型编码。

默认取值:

不涉及。

category_layer_id

否

String

参数解释:

工作项类型层级关系ID,此参数影响工作项的层级显示。通过获取模型树配置信息获取,根据参数中的category在响应消息体中category_layer_config中找到对应的category_code,和category_code同级的id就是工作项类型层级关系ID。

约束限制:

不涉及。

取值范围:

不涉及。

默认取值:

不涉及。

assignee

是

String

参数解释:

工作项责任人ID。可通过查询项目成员列表接口获取,响应消息体中的id字段的值就是用户ID。

约束限制:

32个字符,由英文字母和数字组成。

取值范围:

不涉及。

默认取值:

不涉及。

plan_pi

否

String

参数解释:

工作项发布计划ID。通过发布/迭代计划列表查询接口查询计划列表,返回参数中PlanVO里面的category=PI的对象的id字段就是发布计划的ID。

约束限制:

默认SR、AR、US、Task、Bug有此字段。

取值范围:

不涉及。

默认取值:

不涉及。

plan_iteration

否

String

参数解释:

工作项完成的迭代计划ID。通过发布/迭代计划列表查询接口查询计划列表,返回参数中PlanVO里面的category=Iteration的对象的id字段就是迭代计划的ID。

约束限制:

18~19个字符的数字字符串。

取值范围:

不涉及。

默认取值:

不涉及。

plan_start_date

否

Long

参数解释:

工作项计划结束日期。

约束限制:

0~13个字符的数字字符串,可选负号前缀。

取值范围:

时间戳。

默认取值:

不涉及。

plan_end_date

否

Long

参数解释:

工作项计划结束日期。

约束限制:

0~13个字符的数字字符串,可选负号前缀。

取值范围:

时间戳。

默认取值:

不涉及。

workload_man_day

否

Integer

参数解释:

工作项计划工时。

约束限制:

1~9个字符的数字字符串,可选1位小数部分。

取值范围:

保留一位小数,取值范围为0~999999999.9。

默认取值:

不涉及。

business_domain

否

String

参数解释:

领域,可以通过查询字段列表接口获取,响应消息体中领域的option字段的值就是领域字段的可选值。

约束限制:

不涉及。

取值范围:

  • software

  • soft-hardware

  • hardware

  • 性能

  • 功能

  • 运维

  • 运营

  • 用户体验

  • 隐私保护

  • 合规

  • 韧性(可靠性/可用性)

  • 韧性(危险检测与相应恢复)

  • 透明

  • 无害

  • 安全

  • API

  • 成本

  • 可维护性

  • 其他DFX

  • 可用性

  • others

默认取值:

不涉及。

need_break

否

String

参数解释:

是否需要分解。可以通过查询字段列表接口获取,响应消息体中是否需要分解的option字段的值就是是否需要分解字段的可选值。

约束限制:

不涉及。

取值范围:

  • yes:需要分解

  • no:不需要分解

默认取值:

不涉及。

响应参数

状态码:200

表5 响应Body参数

参数

参数类型

描述

status

String

参数解释:

接口调用状态。

取值范围:

  • success:批量创建工作项成功

  • error:批量创建工作项失败

message

String

参数解释:

接口调用结果描述,失败时携带失败原因。

取值范围:

不涉及。

result

Array of CreatedIssueDetail objects

参数解释:

批量创建成功的子工作项详情列表,包含每个新建工作项的完整信息。

取值范围:

不涉及。

表6 CreatedIssueDetail

参数

参数类型

描述

id

String

参数解释:

工作项唯一标识ID。

取值范围:

18~19个字符的数字字符串。

number

String

参数解释:

工作项编号,按业务规则自动生成。

取值范围:

不涉及。

title

String

参数解释:

工作项标题。

取值范围:

不涉及。

description

String

参数解释:

工作项描述。

取值范围:

不涉及。

category

String

参数解释:

工作项类型。

取值范围:

不涉及。

category_layer_id

String

参数解释:

工作项所属分层ID。

取值范围:

不涉及。

parent_id

String

参数解释:

父工作项唯一标识ID。

取值范围:

18~19个字符的数字字符串。

domain_id

Object

参数解释:

所属领域(模块)信息。

取值范围:

不涉及。

status

Object

参数解释:

工作项状态信息。

取值范围:

不涉及。

priority

Object

参数解释:

工作项优先级信息。

取值范围:

不涉及。

assignee

Object

参数解释:

工作项责任人信息。

取值范围:

不涉及。

created_by

Object

参数解释:

工作项创建人信息。

取值范围:

不涉及。

modified_by

Object

参数解释:

工作项最后修改人信息。

取值范围:

不涉及。

created_date

String

参数解释:

工作项创建时间,使用UTC时区的时间戳格式。

取值范围:

不涉及。

modified_date

String

参数解释:

工作项最后修改时间,使用UTC时区的时间戳格式。

取值范围:

不涉及。

plan_start_date

String

参数解释:

计划开始日期。

取值范围:

不涉及。

plan_end_date

String

参数解释:

计划完成日期。

取值范围:

不涉及。

workload_man_day

String

参数解释:

工作项工作量(人天)。

取值范围:

不涉及。

business_domain

Object

参数解释:

业务领域信息。

取值范围:

不涉及。

need_break

Object

参数解释:

是否需要分解字段值信息。

取值范围:

不涉及。

break_status

Object

参数解释:

分解状态信息。

取值范围:

不涉及。

severity

String

参数解释:

严重程度。

取值范围:

不涉及。

region

String

参数解释:

局点标识。

取值范围:

不涉及。

tenant_id

String

参数解释:

租户ID。

取值范围:

不涉及。

state

String

参数解释:

工作项状态描述。

取值范围:

不涉及。

stay_days

Integer

参数解释:

停留天数。

取值范围:

不涉及。

position_float

Number

参数解释:

工作项排序字段。

取值范围:

不涉及。

setup

Boolean

参数解释:

是否初始化完成。

取值范围:

  • true:初始化完成

  • false:初始化未完成

状态码:400

表7 响应Body参数

参数

参数类型

描述

error_code

String

参数解释:

错误码。

取值范围:

不涉及。

error_msg

String

参数解释:

错误描述,对error_code的补充解释。

取值范围:

不涉及。

请求示例

POST https://{endpoint}/v1/ipdprojectservice/projects/8a5cc89982a44f53bdd55a050dfffa6f/issues/batch-create

[ {
  "parent_id" : "1300180570080055297",
  "category_layer_id" : "10003",
  "category" : "SR",
  "title" : "子工作项01",
  "description" : "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
  "domain_id" : "1250495940590870528",
  "status" : "Start",
  "assignee" : "a360371833bf4c558f796fd707b44daf",
  "module" : "",
  "priority" : "高",
  "plan_pi" : "",
  "plan_iteration" : "",
  "plan_start_date" : "",
  "plan_end_date" : "1780761600000",
  "workload_man_day" : "11.0",
  "business_domain" : "soft-hardware",
  "need_break" : "yes",
  "no_break_reason" : "",
  "assigned_cc" : "",
  "severity" : ""
}, {
  "parent_id" : "1300180570080055297",
  "category_layer_id" : "10003",
  "category" : "SR",
  "title" : "子SR工作项01",
  "description" : "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
  "domain_id" : "1250495940590870528",
  "status" : "Start",
  "assignee" : "a360371833bf4c558f796fd707b44daf",
  "module" : "",
  "priority" : "高",
  "plan_pi" : "",
  "plan_iteration" : "",
  "plan_start_date" : "",
  "plan_end_date" : 1782662400000,
  "workload_man_day" : "11.0",
  "business_domain" : "soft-hardware",
  "need_break" : "yes",
  "no_break_reason" : "",
  "assigned_cc" : "",
  "severity" : ""
} ]

响应示例

状态码:200

{
  "status" : "success",
  "message" : "",
  "result" : [ {
    "position_float" : 9.999989973003197E9,
    "develop_owner" : null,
    "type" : "requirement",
    "plan_test_end_date" : null,
    "domain_id" : {
      "id" : "1250495940590870528",
      "name" : "IPD-系统设备类0413001",
      "title" : "IPD-系统设备类0413001",
      "project_id" : "8a5cc89982a44f53bdd55a050dfffa6f",
      "parent_id" : null,
      "category" : "Project",
      "created_by" : "a360371833bf4c558f796fd707b44daf",
      "model_id" : "10001",
      "children" : [ ],
      "project_template_id" : "10001",
      "category_template_id" : "10001",
      "category_template_name" : null,
      "feature_template_id" : "10001",
      "feature_template_name" : null,
      "is_managed_by_tenant" : false,
      "is_locked" : false
    },
    "convolution_actual_hours" : null,
    "number" : "SR20260909181112",
    "path" : null,
    "children" : null,
    "workload_man_day" : "11.0",
    "c7395285812113928192" : "",
    "id" : "1304479185522954241",
    "ir2feature" : null,
    "state" : "正在工作",
    "stay_days" : 0,
    "need_break" : {
      "id" : "1250531739071512611",
      "field_id" : "10164",
      "display_value" : "是",
      "value" : "yes",
      "code" : "yes",
      "value_py" : "yes",
      "sequence" : 1,
      "level" : 1,
      "domain_id" : "1250495940590870528",
      "belong_definition_type" : "5"
    },
    "collaborative_history" : null,
    "related_network_security" : null,
    "assigned_cc" : "",
    "module" : "",
    "workitem2label" : null,
    "baseline" : null,
    "close_time" : null,
    "modified_date" : "1788941673000",
    "priority" : {
      "id" : "1250531739071512598",
      "field_id" : "10042",
      "display_value" : "高",
      "value" : "高",
      "code" : "高",
      "value_py" : "3",
      "sequence" : 1,
      "level" : 1,
      "domain_id" : "1250495940590870528",
      "belong_definition_type" : "5"
    },
    "created_by" : {
      "user_id" : "a360371833bf4c558f796fd707b44daf",
      "user_name" : "devcloud_devcloud_s00404480_01",
      "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
      "nick_name" : "昵称0720",
      "role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
      "role_name" : "项目经理,项目管理员",
      "role_alias_name" : "Project manager,Project admin",
      "role_code" : "Project manager,project_admin"
    },
    "break_status" : {
      "id" : "1250531739071512602",
      "field_id" : "10253",
      "display_value" : "未分解",
      "value" : "undecomposed",
      "code" : "undecomposed",
      "value_py" : "undecomposed",
      "sequence" : 2,
      "level" : 1,
      "domain_id" : "1250495940590870528",
      "belong_definition_type" : "5"
    },
    "status_modified_date" : "1788941673000",
    "important" : null,
    "collaboratives" : null,
    "parent_id" : "1300180570080055297",
    "business_domain" : {
      "id" : "1250531739075706888",
      "field_id" : "10024",
      "display_value" : "软硬件",
      "value" : "soft-hardware",
      "code" : "soft-hardware",
      "value_py" : "ryj",
      "sequence" : 1,
      "level" : 1,
      "domain_id" : "1250495940590870528",
      "belong_definition_type" : "5"
    },
    "assignee" : {
      "user_id" : "a360371833bf4c558f796fd707b44daf",
      "user_name" : "devcloud_devcloud_s00404480_01",
      "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
      "nick_name" : "昵称0720",
      "role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
      "role_name" : "项目经理,项目管理员",
      "role_alias_name" : "Project manager,Project admin",
      "role_code" : "Project manager,project_admin"
    },
    "region" : "cn-north-7",
    "status" : {
      "id" : "1250531742158520329",
      "belonging" : "START",
      "name" : "初始",
      "code" : "Start",
      "definition_type" : "5",
      "belong_definition_type" : 3,
      "display_value" : "初始",
      "linkage_node_fields" : false
    },
    "plan_pi" : "",
    "tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
    "link" : null,
    "plan_dev_end_date" : null,
    "description" : "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
    "is_suspended" : null,
    "change_status" : null,
    "title" : "子工作项01",
    "sum_workload_man_day" : null,
    "plan_end_date" : "1780761600000",
    "plan_start_date" : "",
    "severity" : "",
    "convolution_plan_hours" : null,
    "category_layer_id" : "10003",
    "no_break_reason" : "",
    "c7468879297717088256" : "",
    "plan_iteration" : "",
    "cascade_delete" : null,
    "test_owner" : null,
    "modified_by" : {
      "user_id" : "a360371833bf4c558f796fd707b44daf",
      "user_name" : "devcloud_devcloud_s00404480_01",
      "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
      "nick_name" : "昵称0720",
      "role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
      "role_name" : "项目经理,项目管理员",
      "role_alias_name" : "Project manager,Project admin",
      "role_code" : "Project manager,project_admin"
    },
    "closed_flag" : null,
    "created_date" : "1788941673000",
    "category" : "SR",
    "collaborative_status" : [ ],
    "setup" : true
  }, {
    "position_float" : 9.999989972347837E9,
    "develop_owner" : null,
    "type" : "requirement",
    "plan_test_end_date" : null,
    "domain_id" : {
      "id" : "1250495940590870528",
      "name" : "IPD-系统设备类0413001",
      "title" : "IPD-系统设备类0413001",
      "project_id" : "8a5cc89982a44f53bdd55a050dfffa6f",
      "parent_id" : null,
      "category" : "Project",
      "created_by" : "a360371833bf4c558f796fd707b44daf",
      "model_id" : "10001",
      "children" : [ ],
      "project_template_id" : "10001",
      "category_template_id" : "10001",
      "category_template_name" : null,
      "feature_template_id" : "10001",
      "feature_template_name" : null,
      "is_managed_by_tenant" : false,
      "is_locked" : false
    },
    "convolution_actual_hours" : null,
    "number" : "SR20260909181113",
    "path" : null,
    "children" : null,
    "workload_man_day" : "11.0",
    "c7395285812113928192" : "",
    "id" : "1304479185535537152",
    "ir2feature" : null,
    "state" : "正在工作",
    "stay_days" : 0,
    "need_break" : {
      "id" : "1250531739071512611",
      "field_id" : "10164",
      "display_value" : "是",
      "value" : "yes",
      "code" : "yes",
      "value_py" : "yes",
      "sequence" : 1,
      "level" : 1,
      "domain_id" : "1250495940590870528",
      "belong_definition_type" : "5"
    },
    "collaborative_history" : null,
    "related_network_security" : null,
    "assigned_cc" : "",
    "module" : "",
    "workitem2label" : null,
    "baseline" : null,
    "close_time" : null,
    "modified_date" : "1788941673000",
    "priority" : {
      "id" : "1250531739071512598",
      "field_id" : "10042",
      "display_value" : "高",
      "value" : "高",
      "code" : "高",
      "value_py" : "3",
      "sequence" : 1,
      "level" : 1,
      "domain_id" : "1250495940590870528",
      "belong_definition_type" : "5"
    },
    "created_by" : {
      "user_id" : "a360371833bf4c558f796fd707b44daf",
      "user_name" : "devcloud_devcloud_s00404480_01",
      "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
      "nick_name" : "昵称0720",
      "role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
      "role_name" : "项目经理,项目管理员",
      "role_alias_name" : "Project manager,Project admin",
      "role_code" : "Project manager,project_admin"
    },
    "break_status" : {
      "id" : "1250531739071512602",
      "field_id" : "10253",
      "display_value" : "未分解",
      "value" : "undecomposed",
      "code" : "undecomposed",
      "value_py" : "undecomposed",
      "sequence" : 2,
      "level" : 1,
      "domain_id" : "1250495940590870528",
      "belong_definition_type" : "5"
    },
    "status_modified_date" : "1788941673000",
    "important" : null,
    "collaboratives" : null,
    "parent_id" : "1300180570080055297",
    "business_domain" : {
      "id" : "1250531739075706888",
      "field_id" : "10024",
      "display_value" : "软硬件",
      "value" : "soft-hardware",
      "code" : "soft-hardware",
      "value_py" : "ryj",
      "sequence" : 1,
      "level" : 1,
      "domain_id" : "1250495940590870528",
      "belong_definition_type" : "5"
    },
    "assignee" : {
      "user_id" : "a360371833bf4c558f796fd707b44daf",
      "user_name" : "devcloud_devcloud_s00404480_01",
      "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
      "nick_name" : "昵称0720",
      "role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
      "role_name" : "项目经理,项目管理员",
      "role_alias_name" : "Project manager,Project admin",
      "role_code" : "Project manager,project_admin"
    },
    "region" : "cn-north-7",
    "status" : {
      "id" : "1250531742158520329",
      "belonging" : "START",
      "name" : "初始",
      "code" : "Start",
      "definition_type" : "5",
      "belong_definition_type" : 3,
      "display_value" : "初始",
      "linkage_node_fields" : false
    },
    "plan_pi" : "",
    "tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
    "link" : null,
    "plan_dev_end_date" : null,
    "description" : "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
    "is_suspended" : null,
    "change_status" : null,
    "title" : "子SR工作项01",
    "sum_workload_man_day" : null,
    "plan_end_date" : "1782662400000",
    "plan_start_date" : "",
    "severity" : "",
    "convolution_plan_hours" : null,
    "category_layer_id" : "10003",
    "no_break_reason" : "",
    "c7468879297717088256" : "",
    "plan_iteration" : "",
    "cascade_delete" : null,
    "test_owner" : null,
    "modified_by" : {
      "user_id" : "a360371833bf4c558f796fd707b44daf",
      "user_name" : "devcloud_devcloud_s00404480_01",
      "domain_id" : "4e919d73499648e3b0292cd3cbef806a",
      "nick_name" : "昵称0720",
      "role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
      "role_name" : "项目经理,项目管理员",
      "role_alias_name" : "Project manager,Project admin",
      "role_code" : "Project manager,project_admin"
    },
    "closed_flag" : null,
    "created_date" : "1788941673000",
    "category" : "SR",
    "collaborative_status" : [ ],
    "setup" : true
  } ]
}

状态码:400

{
  "error_code" : "PM.02174103",
  "error_msg" : "无操作权限"
}

SDK代码示例

SDK代码示例如下。

Java

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.projectman.v4.region.ProjectManRegion;
import com.huaweicloud.sdk.projectman.v4.*;
import com.huaweicloud.sdk.projectman.v4.model.*;

import java.util.List;
import java.util.ArrayList;

public class BatchCreateIpdIssuesSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");

        ICredential auth = new BasicCredentials()
                .withAk(ak)
                .withSk(sk);

        ProjectManClient client = ProjectManClient.newBuilder()
                .withCredential(auth)
                .withRegion(ProjectManRegion.valueOf("<YOUR REGION>"))
                .build();
        BatchCreateIpdIssuesRequest request = new BatchCreateIpdIssuesRequest();
        request.withProjectId("{project_id}");
        List<CreateIpdProjectIssueParam> listbodyBody = new ArrayList<>();
        listbodyBody.add(
            new CreateIpdProjectIssueParam()
                .withTitle("子工作项01")
                .withDescription("<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>")
                .withStatus("Start")
                .withDomainId("1250495940590870528")
                .withPriority("高")
                .withAssignedCc()
                .withCategory("SR")
                .withAssignee("a360371833bf4c558f796fd707b44daf")
                .withPlanPi("")
                .withPlanIteration("")
                .withPlanStartDate(L)
                .withPlanEndDate(1780761600000L)
                .withWorkloadManDay(11.0)
                .withBusinessDomain("soft-hardware")
                .withNeedBreak("yes")
                .withCategoryLayerId("10003")
                .withParentId("1300180570080055297")
        );
        listbodyBody.add(
            new CreateIpdProjectIssueParam()
                .withTitle("子SR工作项01")
                .withDescription("<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>")
                .withStatus("Start")
                .withDomainId("1250495940590870528")
                .withPriority("高")
                .withAssignedCc()
                .withCategory("SR")
                .withAssignee("a360371833bf4c558f796fd707b44daf")
                .withPlanPi("")
                .withPlanIteration("")
                .withPlanStartDate(L)
                .withPlanEndDate(1782662400000L)
                .withWorkloadManDay(11.0)
                .withBusinessDomain("soft-hardware")
                .withNeedBreak("yes")
                .withCategoryLayerId("10003")
                .withParentId("1300180570080055297")
        );
        request.withBody(listbodyBody);
        try {
            BatchCreateIpdIssuesResponse response = client.batchCreateIpdIssues(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}

Python

 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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkprojectman.v4.region.projectman_region import ProjectManRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkprojectman.v4 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]

    credentials = BasicCredentials(ak, sk)

    client = ProjectManClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(ProjectManRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = BatchCreateIpdIssuesRequest()
        request.project_id = "{project_id}"
        listBodybody = [
            CreateIpdProjectIssueParam(
                title="子工作项01",
                description="<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
                status="Start",
                domain_id="1250495940590870528",
                priority="高",
                category="SR",
                assignee="a360371833bf4c558f796fd707b44daf",
                plan_pi="",
                plan_iteration="",
                plan_start_date=,
                plan_end_date=1780761600000,
                workload_man_day=11.0,
                business_domain="soft-hardware",
                need_break="yes",
                category_layer_id="10003",
                parent_id="1300180570080055297"
            ),
            CreateIpdProjectIssueParam(
                title="子SR工作项01",
                description="<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
                status="Start",
                domain_id="1250495940590870528",
                priority="高",
                category="SR",
                assignee="a360371833bf4c558f796fd707b44daf",
                plan_pi="",
                plan_iteration="",
                plan_start_date=,
                plan_end_date=1782662400000,
                workload_man_day=11.0,
                business_domain="soft-hardware",
                need_break="yes",
                category_layer_id="10003",
                parent_id="1300180570080055297"
            )
        ]
        request.body = listBodybody
        response = client.batch_create_ipd_issues(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)

Go

  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
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    projectman "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/projectman/v4/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")

    auth, err := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        SafeBuild()

    if err != nil {
        fmt.Println(err)
        return
    }

    hcClient, err := projectman.ProjectManClientBuilder().
         WithRegion(region.ValueOf("<YOUR REGION>")).
         WithCredential(auth).
         SafeBuild()


    if err != nil {
        fmt.Println(err)
        return
    }

    client := projectman.NewProjectManClient(hcClient)

    request := &model.BatchCreateIpdIssuesRequest{}
	request.ProjectId = "{project_id}"
	titleBody:= "子工作项01"
	descriptionBody:= "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>"
	statusBody:= "Start"
	domainIdBody:= "1250495940590870528"
	priorityBody:= "高"
	categoryBody:= "SR"
	assigneeBody:= "a360371833bf4c558f796fd707b44daf"
	planPiBody:= ""
	planIterationBody:= ""
	planStartDateBody:= int64()
	planEndDateBody:= int64(1780761600000)
	workloadManDayBody:= int32(11.0)
	businessDomainBody:= "soft-hardware"
	needBreakBody:= "yes"
	categoryLayerIdBody:= "10003"
	parentIdBody:= "1300180570080055297"
	titleBody1:= "子SR工作项01"
	descriptionBody1:= "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>"
	statusBody1:= "Start"
	domainIdBody1:= "1250495940590870528"
	priorityBody1:= "高"
	categoryBody1:= "SR"
	assigneeBody1:= "a360371833bf4c558f796fd707b44daf"
	planPiBody1:= ""
	planIterationBody1:= ""
	planStartDateBody1:= int64()
	planEndDateBody1:= int64(1782662400000)
	workloadManDayBody1:= int32(11.0)
	businessDomainBody1:= "soft-hardware"
	needBreakBody1:= "yes"
	categoryLayerIdBody1:= "10003"
	parentIdBody1:= "1300180570080055297"
	var listBodybody = []model.CreateIpdProjectIssueParam{
        {
            Title: &titleBody,
            Description: &descriptionBody,
            Status: &statusBody,
            DomainId: &domainIdBody,
            Priority: &priorityBody,
            Category: &categoryBody,
            Assignee: &assigneeBody,
            PlanPi: &planPiBody,
            PlanIteration: &planIterationBody,
            PlanStartDate: &planStartDateBody,
            PlanEndDate: &planEndDateBody,
            WorkloadManDay: &workloadManDayBody,
            BusinessDomain: &businessDomainBody,
            NeedBreak: &needBreakBody,
            CategoryLayerId: &categoryLayerIdBody,
            ParentId: &parentIdBody,
        },
        {
            Title: &titleBody1,
            Description: &descriptionBody1,
            Status: &statusBody1,
            DomainId: &domainIdBody1,
            Priority: &priorityBody1,
            Category: &categoryBody1,
            Assignee: &assigneeBody1,
            PlanPi: &planPiBody1,
            PlanIteration: &planIterationBody1,
            PlanStartDate: &planStartDateBody1,
            PlanEndDate: &planEndDateBody1,
            WorkloadManDay: &workloadManDayBody1,
            BusinessDomain: &businessDomainBody1,
            NeedBreak: &needBreakBody1,
            CategoryLayerId: &categoryLayerIdBody1,
            ParentId: &parentIdBody1,
        },
    }
	request.Body = &listBodybody
	response, err := client.BatchCreateIpdIssues(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

更多

更多编程语言的SDK代码示例,请参见API Explorer的代码示例页签,可生成自动对应的SDK代码示例。

状态码

状态码

描述

200

批量创建工作项成功。

400

请求失败的响应。例如无操作权限、项目不存在。

错误码

请参见错误码。

相关文档