Batch Deleting IPD Project Work Items
Function
This API is used to batch delete IPD project work items. The deletion operation sets the work item status to "Discarded". It supports deleting multiple work items in a single request. The response lists the IDs of successfully deleted, failed-to-delete, and non-deletable work items.
Calling Method
For details, see Calling APIs.
Authorization Information
No identity policy-based permission required for calling this API.
URI
DELETE /v1/ipdprojectservice/projects/{project_id}/issues/batch-delete
| 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 |
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 BatchDeleteIssueResult objects | Definition Result list of the batch deletion, including the success, failure, and non-deletable work item tree information for each project. Range N/A |
| Parameter | Type | Description |
|---|---|---|
| success | Array of DeletedIssueInfo objects | Definition List of details of successfully deleted work items. Range N/A |
| failed | Array of strings | Definition ID list of work items that failed to be deleted. Range N/A |
| undeleteIssueTrees | Array of strings | Definition List of IDs of work items that cannot be deleted. These work items cannot be directly deleted due to service rule restrictions. Range N/A |
| success_num | Integer | Definition Number of work items that were successfully deleted. Range 0–50 |
| fail_num | Integer | Definition Number of work items that failed to be deleted. Range 0–50 |
| Parameter | Type | Description |
|---|---|---|
| id | String | Definition Unique ID of the work item. Range A numeric string of 18 to 19 characters. |
| state | String | Definition Current work item status description. Range Discarded. |
| plan_pi | String | Definition Release plan to which the work item belongs. Range N/A |
| plan_iteration | String | Definition Sprint to which the work item belongs. Range N/A |
| modified_by | String | Definition Last modifier ID. Range A string of 32 characters. |
| modified_date | String | Definition Last modification time of the work item, in UTC timestamp format. Range N/A |
| sum_workload_man_day | String | Definition Total workload of the work item (person-days). Range N/A |
| cascade_delete | String | Definition Cascading deletion mode. Range |
| operation_id | String | Definition Operation sequence number, unique identifier of each deletion operation. Range UUID string of 36 characters. |
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
Delete the work item with ID 1304481492646006784 under project 8a5cc89982a44f53bdd55a050dfffa6f.
DELETE https://{endpoint}/v1/ipdprojectservice/projects/8a5cc89982a44f53bdd55a050dfffa6f/issues/batch-delete
[ "1304481492646006784" ] Example Responses
Status code: 200
{
"status" : "success",
"message" : "success",
"result" : [ {
"success" : [ {
"sum_workload_man_day" : "",
"plan_pi" : "",
"cascade_delete" : "none",
"modified_by" : "a360371833bf4c558f796fd707b44daf",
"operation_id" : "ca01c19b-37e1-4717-80c4-c0c7a1cbccc0",
"state" : "Discarded.",
"id" : "1304481492646006784",
"modified_date" : "1788942748392",
"plan_iteration" : ""
} ],
"failed" : [ ],
"undeleteIssueTrees" : [ ],
"success_num" : 1,
"fail_num" : 0
} ]
} Status code: 400
{
"error_code" : "PM.02174103",
"error_msg" : "No permission."
} SDK Sample Code
The SDK sample code is as follows.
Java
Delete the work item with ID 1304481492646006784 under project 8a5cc89982a44f53bdd55a050dfffa6f.
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 | 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 BatchDeleteIpdIssueSolution { 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(); BatchDeleteIpdIssueRequest request = new BatchDeleteIpdIssueRequest(); request.withProjectId("{project_id}"); List<String> listbodyBody = new ArrayList<>(); listbodyBody.add("1304481492646006784"); request.withBody(listbodyBody); try { BatchDeleteIpdIssueResponse response = client.batchDeleteIpdIssue(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
Delete the work item with ID 1304481492646006784 under project 8a5cc89982a44f53bdd55a050dfffa6f.
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 | # 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 = BatchDeleteIpdIssueRequest() request.project_id = "{project_id}" listBodybody = [ "1304481492646006784" ] request.body = listBodybody response = client.batch_delete_ipd_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
Delete the work item with ID 1304481492646006784 under project 8a5cc89982a44f53bdd55a050dfffa6f.
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 | 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.BatchDeleteIpdIssueRequest{} request.ProjectId = "{project_id}" var listBodybody = []string{ "1304481492646006784", } request.Body = &listBodybody response, err := client.BatchDeleteIpdIssue(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 deleted 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