Batch Creating IPD Project Work Items
Function
This API is used to batch create IPD project work items. Multiple work items can be created in a single request. This API is applicable to scenarios such as importing child work items in batches and creating tasks in batches.
Calling Method
For details, see Calling APIs.
Authorization Information
No identity policy-based permission required for calling this API.
URI
POST /v1/ipdprojectservice/projects/{project_id}/issues/batch-create
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| project_id | Yes | String | Definition 32-character unique project ID, which uniquely identifies a project. It can be obtained by calling the Listing Projects API. The value of the id field in the response body is the project ID. Constraints N/A Range 32 characters. Default Value N/A |
Request Parameters
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| X-Auth-Token | Yes | String | Definition User token. Obtain a token by calling the IAM API for obtaining a user token. The value of X-Subject-Token in the response header is the user token. Constraints N/A Range 10 to 32,768 characters Default Value N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| [items] | Yes | Array of CreateIpdProjectIssueRequestBody objects | Definition Work item creation model. Constraints N/A |
| Parameter | Mandatory | Type | Description |
|---|---|---|---|
| title | Yes | String | Definition Work item title. Constraints N/A Range 2 to 256 characters. Default Value N/A |
| description | Yes | String | Definition Work item description field. Constraints N/A Range 0 to 500,000 characters. Default Value N/A |
| status | No | String | Definition Work item status code. Obtain the value from the Querying the Work Item Status API. The value is code in the response body. Constraints N/A Range N/A Default Value N/A |
| src_domain | No | String | Definition ID of the project space of the work item's proposing project. Obtain the value by calling the Querying the IPD Project List API. The value of domain_id in the response message body is the project space ID. Constraints A string of 32 characters consisting of letters and digits. Range N/A Default Value N/A |
| submitted_by | No | String | Definition Submitter ID. Obtain a user ID by calling the API for querying project members. The value of id in the response message body is a user ID. Constraints A string of 32 characters consisting of lowercase letters and digits. Range N/A Default Value |
| domain_id | No | String | Definition ID of the project space of the work item's responsible project. Obtain the value by calling the Querying the IPD Project List API. The value of domain_id in the response message body is the project space ID. Constraints A string of 32 characters consisting of letters and digits. Range N/A Default Value N/A |
| recipient | No | Array of strings | Definition Recipient ID. Obtain a user ID by calling the API for querying project members. The value of id in the response message body is a user ID. Constraints A string of 32 characters consisting of lowercase letters and digits. |
| expect_delivery_time | No | Long | Definition Expected completion time. Constraints N/A Range Timestamp. Default Value N/A |
| priority | No | String | Definition Priority. You can obtain the value of this parameter using the Querying the Field List API. The value is the option field in the response message body. Constraints N/A Range Default Value N/A |
| assigned_cc | No | Array of strings | Definition Cc recipient ID of a work item. Multiple Cc recipients are supported. Constraints A work item can be copied to a maximum of 50 recipients. |
| category | Yes | String | Definition Work item type. When editing a work item, this field is mandatory. The value must be the correct type of the current work item, but this field will not be updated. Constraints N/A Range Multiple work item types are supported, separated by commas (,).
Default Value N/A |
| category_layer_id | No | String | Definition ID of the work item type hierarchy. This parameter affects the display of work item levels. Obtain the value from the API for obtaining the model tree configuration. Find the corresponding category_code in the category_layer_config of the response body based on the category parameter. The id at the same level as category_code is the work item type hierarchy ID. Constraints N/A Range N/A Default Value N/A |
| assignee | Yes | String | Definition Work item owner ID. Obtain a user ID by calling the API for querying project members. The value of id in the response message body is a user ID. Constraints A string of 32 characters consisting of letters and digits. Range N/A Default Value N/A |
| plan_pi | No | String | Definition Work item release plan ID. You can query the plan list by calling the API for querying the release/sprint plan list. The id field of the object with category=PI in PlanVO in the returned parameters is the release plan ID. Constraints This field is available for SRs, ARs, USs, tasks, and bugs by default. Range N/A Default Value N/A |
| plan_iteration | No | String | Definition ID of the sprint plan in which the work item is completed. You can query the plan list by calling the API for querying the release/sprint plan list. The id field of the object with category=Iteration in PlanVO in the returned parameters is the sprint plan ID. Constraints A string of 18 to 19 digits. Range N/A Default Value N/A |
| plan_start_date | No | Long | Definition Planned end date of a work item. Constraints A string of 0 to 13 digits. The negative sign (-) can be used as the prefix. Range Timestamp. Default Value N/A |
| plan_end_date | No | Long | Definition Planned end date of a work item. Constraints A string of 0 to 13 digits. The negative sign (-) can be used as the prefix. Range Timestamp. Default Value N/A |
| workload_man_day | No | Integer | Definition Planned workloads of a work item. Constraints A string of 1 to 9 digits. The value can contain one decimal place. Range The value is a number with one decimal place. The value range is 0–999999999.9. Default Value N/A |
| business_domain | No | String | Definition Domain. You can obtain the value from the Querying the Field List API. The value is the option field in the response message body. Constraints N/A Range Default Value N/A |
| need_break | No | String | Definition Whether breakdown is required. You can obtain the value from the Querying the Field List API. The value is the option field of the desired field in the response message body. Constraints N/A Range Default Value N/A |
Response Parameters
Status code: 200
| Parameter | Type | Description |
|---|---|---|
| status | String | Definition API call status. Range |
| message | String | Definition Description of the API call result. The failure cause is provided when the call fails. Range N/A |
| result | Array of CreatedIssueDetail objects | Definition Details of the child work items that are successfully created in batches, including the complete information of each newly created work item. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Unique ID of the work item. Range A numeric string of 18 to 19 characters. |
| number | String | Definition Work item number, automatically generated based on business rules. Range N/A |
| title | String | Definition Work item title. Range N/A |
| description | String | Definition Work item description. Range N/A |
| category | String | Definition Work item type. Range N/A |
| category_layer_id | String | Definition ID of the hierarchy layer to which the work item belongs. Range N/A |
| parent_id | String | Definition Unique ID of the parent work item. Range A numeric string of 18 to 19 characters. |
| domain_id | Object | Definition Information of the domain or module to which the work item belongs. Range N/A |
| status | Object | Definition Work item status information. Range N/A |
| priority | Object | Definition Work item priority information. Range N/A |
| assignee | Object | Definition Work item owner information. Range N/A |
| created_by | Object | Definition Work item creator information. Range N/A |
| modified_by | Object | Definition Last modifier information of the work item. Range N/A |
| created_date | String | Definition Work item creation time, in UTC timestamp format. Range N/A |
| modified_date | String | Definition Last modification time of the work item, in UTC timestamp format. Range N/A |
| plan_start_date | String | Definition Planned start date. Range N/A |
| plan_end_date | String | Definition Planned completion date. Range N/A |
| workload_man_day | String | Definition Work item workload (person-days). Range N/A |
| business_domain | Object | Definition Business domain information. Range N/A |
| need_break | Object | Definition Whether to decompose the field value. Range N/A |
| break_status | Object | Definition Breakdown status information. Range N/A |
| severity | String | Definition Severity. Range N/A |
| region | String | Definition Region identifier. Range N/A |
| tenant_id | String | Definition Tenant ID. Range N/A |
| state | String | Definition Work item status description. Range N/A |
| stay_days | Integer | Definition Number of stay days. Range N/A |
| position_float | Number | Definition Work item sorting field. Range N/A |
| setup | Boolean | Definition Whether initialization is complete. Range |
Status code: 400
| Parameter | Type | Description |
|---|---|---|
| error_code | String | Definition Error code. Range N/A |
| error_msg | String | Definition Error description, which is a supplement to error_code. Range N/A |
Example Requests
POST https://{endpoint}/v1/ipdprojectservice/projects/8a5cc89982a44f53bdd55a050dfffa6f/issues/batch-create
[ {
"parent_id" : "1300180570080055297",
"category_layer_id" : "10003",
"category" : "SR",
"title" : "Child work item 01.",
"description" : "<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>",
"domain_id" : "1250495940590870528",
"status" : "Start",
"assignee" : "a360371833bf4c558f796fd707b44daf",
"module" : "",
"priority" : "High.",
"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" : "Child SR work item 01.",
"description" : "<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>",
"domain_id" : "1250495940590870528",
"status" : "Start",
"assignee" : "a360371833bf4c558f796fd707b44daf",
"module" : "",
"priority" : "High.",
"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" : ""
} ] Example Responses
Status code: 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-System device 0413001.",
"title" : "IPD-System device 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" : "Working.",
"stay_days" : 0,
"need_break" : {
"id" : "1250531739071512611",
"field_id" : "10164",
"display_value" : "Yes.",
"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" : "High.",
"value" : "High.",
"code" : "High.",
"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" : "Nickname 0720.",
"role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
"role_name" : "Project manager, project administrator.",
"role_alias_name" : "Project manager,Project admin",
"role_code" : "Project manager,project_admin"
},
"break_status" : {
"id" : "1250531739071512602",
"field_id" : "10253",
"display_value" : "Undecomposed.",
"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" : "Hardware and software.",
"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" : "Nickname 0720.",
"role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
"role_name" : "Project manager, project administrator.",
"role_alias_name" : "Project manager,Project admin",
"role_code" : "Project manager,project_admin"
},
"region" : "cn-north-7",
"status" : {
"id" : "1250531742158520329",
"belonging" : "START",
"name" : "Initial.",
"code" : "Start",
"definition_type" : "5",
"belong_definition_type" : 3,
"display_value" : "Initial.",
"linkage_node_fields" : false
},
"plan_pi" : "",
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"link" : null,
"plan_dev_end_date" : null,
"description" : "<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>",
"is_suspended" : null,
"change_status" : null,
"title" : "Child work item 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" : "Nickname 0720.",
"role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
"role_name" : "Project manager, project administrator.",
"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-System device 0413001.",
"title" : "IPD-System device 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" : "Working.",
"stay_days" : 0,
"need_break" : {
"id" : "1250531739071512611",
"field_id" : "10164",
"display_value" : "Yes.",
"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" : "High.",
"value" : "High.",
"code" : "High.",
"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" : "Nickname 0720.",
"role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
"role_name" : "Project manager, project administrator.",
"role_alias_name" : "Project manager,Project admin",
"role_code" : "Project manager,project_admin"
},
"break_status" : {
"id" : "1250531739071512602",
"field_id" : "10253",
"display_value" : "Undecomposed.",
"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" : "Hardware and software.",
"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" : "Nickname 0720.",
"role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
"role_name" : "Project manager, project administrator.",
"role_alias_name" : "Project manager,Project admin",
"role_code" : "Project manager,project_admin"
},
"region" : "cn-north-7",
"status" : {
"id" : "1250531742158520329",
"belonging" : "START",
"name" : "Initial.",
"code" : "Start",
"definition_type" : "5",
"belong_definition_type" : 3,
"display_value" : "Initial.",
"linkage_node_fields" : false
},
"plan_pi" : "",
"tenant_id" : "4e919d73499648e3b0292cd3cbef806a",
"link" : null,
"plan_dev_end_date" : null,
"description" : "<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>",
"is_suspended" : null,
"change_status" : null,
"title" : "Child SR work item 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" : "Nickname 0720.",
"role_id" : "720264df24cf49cebcc4d91a439fe9e7,82120827332346b9a12557838ac6f3b0",
"role_name" : "Project manager, project administrator.",
"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
} ]
} Status code: 400
{
"error_code" : "PM.02174103",
"error_msg" : "No permission."
} SDK Sample Code
The SDK sample code is as follows.
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("Child work item 01.") .withDescription("<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>") .withStatus("Start") .withDomainId("1250495940590870528") .withPriority("High.") .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("Child SR work item 01.") .withDescription("<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>") .withStatus("Start") .withDomainId("1250495940590870528") .withPriority("High.") .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="Child work item 01.", description="<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>", status="Start", domain_id="1250495940590870528", priority="High.", 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="Child SR work item 01.", description="<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>", status="Start", domain_id="1250495940590870528", priority="High.", 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:= "Child work item 01." descriptionBody:= "<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>" statusBody:= "Start" domainIdBody:= "1250495940590870528" priorityBody:= "High." 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:= "Child SR work item 01." descriptionBody1:= "<p>[Requirement background]</p><p><br></p><p>[Requirement value]</p><p><br></p><p>[Requirement details]</p>" statusBody1:= "Start" domainIdBody1:= "1250495940590870528" priorityBody1:= "High." 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) } } |
More
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
| Status Code | Description |
|---|---|
| 200 | Work items are batch created successfully. |
| 400 | Response upon a request failure. For example, the user does not have the operation permission or the project does not exist. |
Error Codes
See Error Codes.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot