文档首页/ 需求管理 CodeArts Req/ API参考/ API/ IPD工作项管理/ 创建IPD工作项 - CreateIpdProjectIssue
更新时间:2026-09-01 GMT+08:00
分享

创建IPD工作项 - CreateIpdProjectIssue

功能介绍

创建IPD项目工作项。

调用方法

请参见如何调用API

授权信息

账号根用户具备所有API的调用权限,如果使用账号下的IAM用户调用当前API,该IAM用户需具备如下身份策略权限,更多的权限说明请参见权限和授权项

授权项

访问级别

资源类型(*为必须)

条件键

别名

依赖的授权项

codeartsreq:workitem:create

Write

-

  • codeartsreq:Model

  • codeartsreq:ProjectId

-

-

URI

POST /v1/ipdprojectservice/projects/{project_id}/issues

表1 路径参数

参数

是否必选

参数类型

描述

project_id

String

参数解释

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

约束限制

不涉及。

取值范围

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

默认取值

不涉及。

请求参数

表2 请求Header参数

参数

是否必选

参数类型

描述

X-Auth-Token

String

参数解释

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

约束限制

不涉及。

取值范围

10~32768个字符。

默认取值

不涉及。

表3 请求Body参数

参数

是否必选

参数类型

描述

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

默认取值

不涉及。

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

表4 响应Body参数

参数

参数类型

描述

status

String

参数解释

返回状态。

取值范围

success:响应成功。

error:响应失败

message

String

参数解释

信息。

取值范围

不涉及

result

Array of IssueDetailsResponse objects

参数解释

查询结果。

表5 IssueDetailsResponse

参数

参数类型

描述

id

String

参数解释

工作项ID。

取值范围

不涉及。

number

String

参数解释

工作项编号。

取值范围

不涉及。

type

String

参数解释

工作项类型。

取值范围

不涉及。

stay_days

Integer

参数解释

停留天数。

取值范围

不涉及。

tenant_id

String

参数解释

租户ID。

取值范围

不涉及。

created_date

String

参数解释

工作项创建时间。

取值范围

不涉及。

title

String

参数解释

工作项标题。

取值范围

不涉及。

状态码:400

表6 响应Body参数

参数

参数类型

描述

error_code

String

参数解释

错误码。

取值范围

不涉及。

error_msg

String

参数解释

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

取值范围

不涉及。

请求示例

  • POST https://{endpoint}/v1/ipdprojectservice/projects/de7115f62a96485b8ceaac6e68c701c4/issues
    
    {
      "status" : "Analyse",
      "title" : "模型一原始需求demo",
      "description" : "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
      "src_domain" : "868551927720357888",
      "submitted_by" : "a360371833bf4c558f796fd707b44daf",
      "domain_id" : "868551927720357888",
      "assignee" : "eab51c9c46f84d3aab838e1db6401232",
      "recipient" : [ "a360371833bf4c558f796fd707b44daf" ],
      "priority" : "中",
      "category" : "RR"
    }
  • POST https://{endpoint}/v1/ipdprojectservice/projects/de7115f62a96485b8ceaac6e68c701c4/issues
    
    {
      "title" : "模型二初始需求demo",
      "description" : "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
      "domain_id" : "885117755981602818",
      "status" : "Start",
      "submitted_by" : "eab51c9c46f84d3aab838e1db6401232",
      "assignee" : "eab51c9c46f84d3aab838e1db6401232",
      "priority" : "中",
      "plan_pi" : "885118532431159297",
      "plan_iteration" : "885118693565890561",
      "plan_start_date" : 1688918400000,
      "plan_end_date" : 1690214400000,
      "workload_man_day" : 10,
      "business_domain" : "software",
      "need_break" : "yes",
      "assigned_cc" : [ "eab51c9c46f84d3aab838e1db6401232" ],
      "category" : "IR"
    }
  • POST https://{endpoint}/v1/ipdprojectservice/projects/de7115f62a96485b8ceaac6e68c701c4/issues
    
    {
      "title" : "模型三任务demo",
      "description" : "<p>【任务背景】</p><p><br></p><p>【任务价值】</p><p><br></p><p>【任务详情】</p>",
      "domain_id" : "885119056444489729",
      "status" : "Start",
      "assignee" : "eab51c9c46f84d3aab838e1db6401232",
      "priority" : "中",
      "assigned_cc" : [ "eab51c9c46f84d3aab838e1db6401232" ],
      "business_domain" : "software",
      "plan_start_date" : 1688918400000,
      "plan_end_date" : 1690214400000,
      "workload_man_day" : 12,
      "category" : "Task"
    }

响应示例

状态码:200

创建原始需求成功响应

{
  "status" : "success",
  "message" : "",
  "result" : [ {
    "domain_id" : "1273201979687350273",
    "id" : "1281298264407584768",
    "assignee" : "ee3ae960aa2247a2973eb34e4ea30f58",
    "category" : "RR",
    "created_by" : "029f95b680474fa396fcaba6a73954af",
    "status" : "Plan"
  } ],
  "page" : null
}

状态码: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
    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 CreateIpdProjectIssueSolution {
    
        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();
            CreateIpdProjectIssueRequest request = new CreateIpdProjectIssueRequest();
            request.withProjectId("{project_id}");
            CreateIpdProjectIssueParam body = new CreateIpdProjectIssueParam();
            List<String> listbodyRecipient = new ArrayList<>();
            listbodyRecipient.add("a360371833bf4c558f796fd707b44daf");
            body.withAssignee("eab51c9c46f84d3aab838e1db6401232");
            body.withCategory("RR");
            body.withPriority("中");
            body.withRecipient(listbodyRecipient);
            body.withDomainId("868551927720357888");
            body.withSubmittedBy("a360371833bf4c558f796fd707b44daf");
            body.withSrcDomain("868551927720357888");
            body.withStatus("Analyse");
            body.withDescription("<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>");
            body.withTitle("模型一原始需求demo");
            request.withBody(body);
            try {
                CreateIpdProjectIssueResponse response = client.createIpdProjectIssue(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());
            }
        }
    }
    
  •  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
    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 CreateIpdProjectIssueSolution {
    
        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();
            CreateIpdProjectIssueRequest request = new CreateIpdProjectIssueRequest();
            request.withProjectId("{project_id}");
            CreateIpdProjectIssueParam body = new CreateIpdProjectIssueParam();
            List<String> listbodyAssignedCc = new ArrayList<>();
            listbodyAssignedCc.add("eab51c9c46f84d3aab838e1db6401232");
            body.withNeedBreak("yes");
            body.withBusinessDomain("software");
            body.withWorkloadManDay(10);
            body.withPlanEndDate(1690214400000L);
            body.withPlanStartDate(1688918400000L);
            body.withPlanIteration("885118693565890561");
            body.withPlanPi("885118532431159297");
            body.withAssignee("eab51c9c46f84d3aab838e1db6401232");
            body.withCategory("IR");
            body.withAssignedCc(listbodyAssignedCc);
            body.withPriority("中");
            body.withDomainId("885117755981602818");
            body.withSubmittedBy("eab51c9c46f84d3aab838e1db6401232");
            body.withStatus("Start");
            body.withDescription("<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>");
            body.withTitle("模型二初始需求demo");
            request.withBody(body);
            try {
                CreateIpdProjectIssueResponse response = client.createIpdProjectIssue(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());
            }
        }
    }
    
  •  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
    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 CreateIpdProjectIssueSolution {
    
        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();
            CreateIpdProjectIssueRequest request = new CreateIpdProjectIssueRequest();
            request.withProjectId("{project_id}");
            CreateIpdProjectIssueParam body = new CreateIpdProjectIssueParam();
            List<String> listbodyAssignedCc = new ArrayList<>();
            listbodyAssignedCc.add("eab51c9c46f84d3aab838e1db6401232");
            body.withBusinessDomain("software");
            body.withWorkloadManDay(12);
            body.withPlanEndDate(1690214400000L);
            body.withPlanStartDate(1688918400000L);
            body.withAssignee("eab51c9c46f84d3aab838e1db6401232");
            body.withCategory("Task");
            body.withAssignedCc(listbodyAssignedCc);
            body.withPriority("中");
            body.withDomainId("885119056444489729");
            body.withStatus("Start");
            body.withDescription("<p>【任务背景】</p><p><br></p><p>【任务价值】</p><p><br></p><p>【任务详情】</p>");
            body.withTitle("模型三任务demo");
            request.withBody(body);
            try {
                CreateIpdProjectIssueResponse response = client.createIpdProjectIssue(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
    # 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 = CreateIpdProjectIssueRequest()
            request.project_id = "{project_id}"
            listRecipientbody = [
                "a360371833bf4c558f796fd707b44daf"
            ]
            request.body = CreateIpdProjectIssueParam(
                assignee="eab51c9c46f84d3aab838e1db6401232",
                category="RR",
                priority="中",
                recipient=listRecipientbody,
                domain_id="868551927720357888",
                submitted_by="a360371833bf4c558f796fd707b44daf",
                src_domain="868551927720357888",
                status="Analyse",
                description="<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
                title="模型一原始需求demo"
            )
            response = client.create_ipd_project_issue(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  •  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
    # 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 = CreateIpdProjectIssueRequest()
            request.project_id = "{project_id}"
            listAssignedCcbody = [
                "eab51c9c46f84d3aab838e1db6401232"
            ]
            request.body = CreateIpdProjectIssueParam(
                need_break="yes",
                business_domain="software",
                workload_man_day=10,
                plan_end_date=1690214400000,
                plan_start_date=1688918400000,
                plan_iteration="885118693565890561",
                plan_pi="885118532431159297",
                assignee="eab51c9c46f84d3aab838e1db6401232",
                category="IR",
                assigned_cc=listAssignedCcbody,
                priority="中",
                domain_id="885117755981602818",
                submitted_by="eab51c9c46f84d3aab838e1db6401232",
                status="Start",
                description="<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>",
                title="模型二初始需求demo"
            )
            response = client.create_ipd_project_issue(request)
            print(response)
        except exceptions.ClientRequestException as e:
            print(e.status_code)
            print(e.request_id)
            print(e.error_code)
            print(e.error_msg)
    
  •  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
    # 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 = CreateIpdProjectIssueRequest()
            request.project_id = "{project_id}"
            listAssignedCcbody = [
                "eab51c9c46f84d3aab838e1db6401232"
            ]
            request.body = CreateIpdProjectIssueParam(
                business_domain="software",
                workload_man_day=12,
                plan_end_date=1690214400000,
                plan_start_date=1688918400000,
                assignee="eab51c9c46f84d3aab838e1db6401232",
                category="Task",
                assigned_cc=listAssignedCcbody,
                priority="中",
                domain_id="885119056444489729",
                status="Start",
                description="<p>【任务背景】</p><p><br></p><p>【任务价值】</p><p><br></p><p>【任务详情】</p>",
                title="模型三任务demo"
            )
            response = client.create_ipd_project_issue(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
    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.CreateIpdProjectIssueRequest{}
    	request.ProjectId = "{project_id}"
    	var listRecipientbody = []string{
            "a360371833bf4c558f796fd707b44daf",
        }
    	assigneeCreateIpdProjectIssueParam:= "eab51c9c46f84d3aab838e1db6401232"
    	categoryCreateIpdProjectIssueParam:= "RR"
    	priorityCreateIpdProjectIssueParam:= "中"
    	domainIdCreateIpdProjectIssueParam:= "868551927720357888"
    	submittedByCreateIpdProjectIssueParam:= "a360371833bf4c558f796fd707b44daf"
    	srcDomainCreateIpdProjectIssueParam:= "868551927720357888"
    	statusCreateIpdProjectIssueParam:= "Analyse"
    	descriptionCreateIpdProjectIssueParam:= "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>"
    	titleCreateIpdProjectIssueParam:= "模型一原始需求demo"
    	request.Body = &model.CreateIpdProjectIssueParam{
    		Assignee: &assigneeCreateIpdProjectIssueParam,
    		Category: &categoryCreateIpdProjectIssueParam,
    		Priority: &priorityCreateIpdProjectIssueParam,
    		Recipient: &listRecipientbody,
    		DomainId: &domainIdCreateIpdProjectIssueParam,
    		SubmittedBy: &submittedByCreateIpdProjectIssueParam,
    		SrcDomain: &srcDomainCreateIpdProjectIssueParam,
    		Status: &statusCreateIpdProjectIssueParam,
    		Description: &descriptionCreateIpdProjectIssueParam,
    		Title: &titleCreateIpdProjectIssueParam,
    	}
    	response, err := client.CreateIpdProjectIssue(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  •  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
    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.CreateIpdProjectIssueRequest{}
    	request.ProjectId = "{project_id}"
    	var listAssignedCcbody = []string{
            "eab51c9c46f84d3aab838e1db6401232",
        }
    	needBreakCreateIpdProjectIssueParam:= "yes"
    	businessDomainCreateIpdProjectIssueParam:= "software"
    	workloadManDayCreateIpdProjectIssueParam:= int32(10)
    	planEndDateCreateIpdProjectIssueParam:= int64(1690214400000)
    	planStartDateCreateIpdProjectIssueParam:= int64(1688918400000)
    	planIterationCreateIpdProjectIssueParam:= "885118693565890561"
    	planPiCreateIpdProjectIssueParam:= "885118532431159297"
    	assigneeCreateIpdProjectIssueParam:= "eab51c9c46f84d3aab838e1db6401232"
    	categoryCreateIpdProjectIssueParam:= "IR"
    	priorityCreateIpdProjectIssueParam:= "中"
    	domainIdCreateIpdProjectIssueParam:= "885117755981602818"
    	submittedByCreateIpdProjectIssueParam:= "eab51c9c46f84d3aab838e1db6401232"
    	statusCreateIpdProjectIssueParam:= "Start"
    	descriptionCreateIpdProjectIssueParam:= "<p>【需求背景】</p><p><br></p><p>【需求价值】</p><p><br></p><p>【需求详情】</p>"
    	titleCreateIpdProjectIssueParam:= "模型二初始需求demo"
    	request.Body = &model.CreateIpdProjectIssueParam{
    		NeedBreak: &needBreakCreateIpdProjectIssueParam,
    		BusinessDomain: &businessDomainCreateIpdProjectIssueParam,
    		WorkloadManDay: &workloadManDayCreateIpdProjectIssueParam,
    		PlanEndDate: &planEndDateCreateIpdProjectIssueParam,
    		PlanStartDate: &planStartDateCreateIpdProjectIssueParam,
    		PlanIteration: &planIterationCreateIpdProjectIssueParam,
    		PlanPi: &planPiCreateIpdProjectIssueParam,
    		Assignee: &assigneeCreateIpdProjectIssueParam,
    		Category: &categoryCreateIpdProjectIssueParam,
    		AssignedCc: &listAssignedCcbody,
    		Priority: &priorityCreateIpdProjectIssueParam,
    		DomainId: &domainIdCreateIpdProjectIssueParam,
    		SubmittedBy: &submittedByCreateIpdProjectIssueParam,
    		Status: &statusCreateIpdProjectIssueParam,
    		Description: &descriptionCreateIpdProjectIssueParam,
    		Title: &titleCreateIpdProjectIssueParam,
    	}
    	response, err := client.CreateIpdProjectIssue(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    
  •  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
    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.CreateIpdProjectIssueRequest{}
    	request.ProjectId = "{project_id}"
    	var listAssignedCcbody = []string{
            "eab51c9c46f84d3aab838e1db6401232",
        }
    	businessDomainCreateIpdProjectIssueParam:= "software"
    	workloadManDayCreateIpdProjectIssueParam:= int32(12)
    	planEndDateCreateIpdProjectIssueParam:= int64(1690214400000)
    	planStartDateCreateIpdProjectIssueParam:= int64(1688918400000)
    	assigneeCreateIpdProjectIssueParam:= "eab51c9c46f84d3aab838e1db6401232"
    	categoryCreateIpdProjectIssueParam:= "Task"
    	priorityCreateIpdProjectIssueParam:= "中"
    	domainIdCreateIpdProjectIssueParam:= "885119056444489729"
    	statusCreateIpdProjectIssueParam:= "Start"
    	descriptionCreateIpdProjectIssueParam:= "<p>【任务背景】</p><p><br></p><p>【任务价值】</p><p><br></p><p>【任务详情】</p>"
    	titleCreateIpdProjectIssueParam:= "模型三任务demo"
    	request.Body = &model.CreateIpdProjectIssueParam{
    		BusinessDomain: &businessDomainCreateIpdProjectIssueParam,
    		WorkloadManDay: &workloadManDayCreateIpdProjectIssueParam,
    		PlanEndDate: &planEndDateCreateIpdProjectIssueParam,
    		PlanStartDate: &planStartDateCreateIpdProjectIssueParam,
    		Assignee: &assigneeCreateIpdProjectIssueParam,
    		Category: &categoryCreateIpdProjectIssueParam,
    		AssignedCc: &listAssignedCcbody,
    		Priority: &priorityCreateIpdProjectIssueParam,
    		DomainId: &domainIdCreateIpdProjectIssueParam,
    		Status: &statusCreateIpdProjectIssueParam,
    		Description: &descriptionCreateIpdProjectIssueParam,
    		Title: &titleCreateIpdProjectIssueParam,
    	}
    	response, err := client.CreateIpdProjectIssue(request)
    	if err == nil {
            fmt.Printf("%+v\n", response)
        } else {
            fmt.Println(err)
        }
    }
    

更多

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

状态码

状态码

描述

200

创建原始需求成功响应

400

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

错误码

请参见错误码

相关文档