Updated on 2026-10-13 GMT+08:00

Deleting Plans in Batches

Function

This API is used to delete release plans or sprints in batches based on the input plan or sprint ID list.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

codeartsreq:plan:delete

Write

-

  • codeartsreq:Model

  • codeartsreq:ProjectId

-

-

URI

DELETE /v1/planservice/projects/{project_id}/plans/batch-delete

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

32-character UUID of a project, which uniquely identifies a project. Obtain the value of this parameter from the project_id field in the response body of the API for querying the project list.

Constraints

A string of 32 characters consisting of letters and digits.

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header 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

A string of 10 to 32,768 characters

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

ids

Yes

Array of strings

Definition

List of release plan/sprint IDs to be deleted in batches. You can obtain the release/sprint ID using the API for querying the release/sprint list. The value of the id field in the response message body is the release/sprint ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

status

String

Definition

Response status.

Range

  • success: The batch operation is successful.

  • error: The batch operation fails.

message

String

Definition

Returned message.

Range

N/A

result

BatchResultVO object

Definition

Batch operation result data.

Table 5 BatchResultVO

Parameter

Type

Description

success_num

Number

Definition

The number of succeeded items in the batch operation task.

Range

N/A

fail_num

Number

Definition

The number of failed items in the batch operation task.

Range

N/A

success

Array of BatchOperateInfo objects

Definition

List of plans that are successfully operated in batches.

failed

Array of BatchOperateInfo objects

Definition

List of plans that fail to be operated in batches.

Table 6 BatchOperateInfo

Parameter

Type

Description

id

String

Definition

Release/Sprint plan ID.

Range

The value is a numeric string of 18 to 19 characters.

modified_by

String

Definition

ID of the last updater.

Range

N/A

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition

Error code.

Range

N/A

error_msg

String

Definition

Error message.

Range

N/A

Example Requests

Deleting plans in batches

DELETE https://{endpoint}/v1/planservice/projects/9548acc581ba498d9895ecdb7d2db5ea/plans/batch-delete

{
  "ids" : [ "1164155086611324928", "1164155134381436929" ]
}

Example Responses

Status code: 200

{
  "status" : "success",
  "message" : null,
  "result" : {
    "success_num" : 2,
    "fail_num" : 0,
    "success" : [ {
      "id" : "1164155086611324928",
      "modified_by" : "a360371833bf4c558f796fd707b44daf"
    }, {
      "id" : "1164155134381436929",
      "modified_by" : "a360371833bf4c558f796fd707b44daf"
    } ],
    "failed" : [ ]
  }
}

SDK Sample Code

The SDK sample code is as follows.

Java

Deleting plans in batches

 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
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 BatchDeletePlansSolution {

    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();
        BatchDeletePlansRequest request = new BatchDeletePlansRequest();
        request.withProjectId("{project_id}");
        BatchOperateReqVO body = new BatchOperateReqVO();
        List<String> listbodyIds = new ArrayList<>();
        listbodyIds.add("1164155086611324928");
        listbodyIds.add("1164155134381436929");
        body.withIds(listbodyIds);
        request.withBody(body);
        try {
            BatchDeletePlansResponse response = client.batchDeletePlans(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

Deleting plans in batches

 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
# 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 = BatchDeletePlansRequest()
        request.project_id = "{project_id}"
        listIdsbody = [
            "1164155086611324928",
            "1164155134381436929"
        ]
        request.body = BatchOperateReqVO(
            ids=listIdsbody
        )
        response = client.batch_delete_plans(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

Deleting plans in batches

 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
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.BatchDeletePlansRequest{}
	request.ProjectId = "{project_id}"
	var listIdsbody = []string{
        "1164155086611324928",
	    "1164155134381436929",
    }
	request.Body = &model.BatchOperateReqVo{
		Ids: listIdsbody,
	}
	response, err := client.BatchDeletePlans(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

Response to a successful request for batch deletion.

400

Error message for batch deletion failure.

Error Codes

See Error Codes.