Help Center/ CodeArts Req/ API Reference/ API/ IPD Work Item Management/ Associating/Disassociating Work Items
Updated on 2026-10-13 GMT+08:00

Associating/Disassociating Work Items

Function

You can dynamically associate or cancel the parent-child relationship and other associations between work items. You can specify whether to associate or cancel the association based on different parameters, or specify the association type, for example, associating with a parent or child work item or another work item.

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:attachment:list

List

-

  • codeartsreq:Model

  • codeartsreq:ProjectId

-

-

URI

PUT /v2/ipdprojectservice/projects/{project_id}/issues/{issue_id}/associated-item

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

32-character ID of a project, which must be unique. Obtain the value by calling the API for querying the IPD project list. The value of id in the response message body is the project ID.

Constraints

N/A

Range

A string of 32 characters consisting of letters and digits.

Default Value

N/A

issue_id

Yes

String

Definition

Unique ID of a work item. You can obtain the value from the Querying Work Items or Querying Tree-shaped Work Items API. The value is id in the response body.

Constraints

N/A

Range

A string of 18 to 19 digits.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

dst_domain_id

Yes

String

Definition

32-character UUID of the target project, which must be unique. Obtain the value by calling the Querying the IPD Project List API. The value of id in the response message body is the project ID. In non-cross-project scenarios, the value is the same as that of project_id in the request path.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 3 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

10 to 32,768 characters

Default Value

N/A

Table 4 Request body parameters

Parameter

Mandatory

Type

Description

associated_ids

Yes

String

Definition

Associated work item ID. Use commas (,) to separate multiple IDs. You can obtain the value from the Querying Work Items or Querying Tree-shaped Work Items API. The value is id in the response body.

Constraints

When link_field_code is link, a maximum of 500 work item IDs can be associated. In other scenarios, a maximum of 50 work item IDs can be associated.

Range

N/A

Default Value

N/A

operation_flag

Yes

Integer

Definition

Operation type flag.

Constraints

N/A

Range

  • 0: associate

  • 1: disassociate

Default Value

N/A

associate_issue_type

Yes

String

Definition

Associated item type code.

Constraints

N/A

Range

Multiple values are supported. Use commas (,) to separate them.

  • For system device projects, options include RR, SF, IR, SR, AR, Task, and Bug.

  • For standalone software projects, options include RR, SF, IR, US, Task, and Bug.

Default Value

N/A

source_issue_type

Yes

String

Definition

Code of the current work item type.

Constraints

N/A

Range

Multiple values are supported. Use commas (,) to separate them.

  • For system device projects, options include RR, SF, IR, SR, AR, Task, and Bug.

  • For standalone software projects, options include RR, SF, IR, US, Task, and Bug.

Default Value

N/A

is_replace

No

Boolean

Definition

Whether to use the replacement mode. The default value is false, indicating that associated items are added. If the value is true, the original associated items will be deleted and replaced with the work items associated this time.

Constraints

N/A

Range

  • false (non-replacement mode)

  • true (replacement mode)

Default Value

false

link_field_code

No

String

Definition

Code of the associated field.

Constraints

N/A

Range

  • link: associated work item

  • us2rr: parent work item (RR) associated with a US

  • rr2us: child work item (US) associated with an RR

  • ir2rr: parent work item (RR) associated with an IR

  • rr2ir: child work item (IR) associated with an RR

  • parent_id: parent work item

  • ir2feature: parent feature

  • feature2ir: child work item (IR) associated with an SF

Default Value

link

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

[items]

Array of AssociateIssuesResponseV2 objects

Association/Disassociation response objects

Table 6 AssociateIssuesResponseV2

Parameter

Type

Description

status

String

Definition

Response status.

Range

success: The work item association is successful.

error: The work item association failed.

message

String

Definition

Association failure cause.

Range

N/A

result

Map<String,Array<AssociateRespDetail>>

Definition

Response result of associating a work item.

Range

N/A

Table 7 AssociateRespDetail

Parameter

Type

Description

issue_id

String

Definition

Associated work item ID. Use commas (,) to separate multiple IDs.

Range

N/A

fail_msg

String

Definition

Failure cause.

Range

N/A

operation_flag

Integer

Definition

Operation type flag.

Range

  • 0: associate

  • 1: disassociate

modified_date

Long

Definition

Modification date.

Range

N/A

modified_by

String

Definition

Modifier.

Range

N/A

Status code: 400

Table 8 Response body parameters

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

Assume that the project ID is 26f251d688044d6ca53f7b1b8829d168, the work item ID is 1211022056590450688, and the work item type is IR. Associate the work item with the task work item whose ID is 1210999503448743936.

PUT https://{endpoint}/v2/ipdprojectservice/projects/26f251d688044d6ca53f7b1b8829d168/issues/1211022056590450688/associated-item?dst_domain_id=26f251d688044d6ca53f7b1b8829d168

{
  "associated_ids" : "1210999503448743936",
  "operation_flag" : 0,
  "associate_issue_type" : "Task",
  "source_issue_type" : "IR"
}

Example Responses

Status code: 200

{
  "status" : "success",
  "message" : "",
  "result" : {
    "fail" : [ ],
    "success" : [ {
      "issue_id" : "1210999503448743936",
      "operation_flag" : 0,
      "modified_date" : "1767085429225",
      "modified_by" : "a360371833bf4c558f796fd707b44daf"
    } ]
  }
}

Status code: 400

{
  "error_code" : "PM.02176410",
  "error_msg" : "The associated work item does not exist."
}

SDK Sample Code

The SDK sample code is as follows.

Java

Assume that the project ID is 26f251d688044d6ca53f7b1b8829d168, the work item ID is 1211022056590450688, and the work item type is IR. Associate the work item with the task work item whose ID is 1210999503448743936.

 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
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.*;


public class AssociateIssuesSolution {

    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();
        AssociateIssuesRequest request = new AssociateIssuesRequest();
        request.withProjectId("{project_id}");
        request.withIssueId("{issue_id}");
        IssueAssociateVO body = new IssueAssociateVO();
        body.withSourceIssueType("IR");
        body.withAssociateIssueType("Task");
        body.withOperationFlag(0);
        body.withAssociatedIds("1210999503448743936");
        request.withBody(body);
        try {
            AssociateIssuesResponse response = client.associateIssues(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

Assume that the project ID is 26f251d688044d6ca53f7b1b8829d168, the work item ID is 1211022056590450688, and the work item type is IR. Associate the work item with the task work item whose ID is 1210999503448743936.

 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 = AssociateIssuesRequest()
        request.project_id = "{project_id}"
        request.issue_id = "{issue_id}"
        request.body = IssueAssociateVO(
            source_issue_type="IR",
            associate_issue_type="Task",
            operation_flag=0,
            associated_ids="1210999503448743936"
        )
        response = client.associate_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

Assume that the project ID is 26f251d688044d6ca53f7b1b8829d168, the work item ID is 1211022056590450688, and the work item type is IR. Associate the work item with the task work item whose ID is 1210999503448743936.

 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.AssociateIssuesRequest{}
	request.ProjectId = "{project_id}"
	request.IssueId = "{issue_id}"
	request.Body = &model.IssueAssociateVo{
		SourceIssueType: "IR",
		AssociateIssueType: "Task",
		OperationFlag: int32(0),
		AssociatedIds: "1210999503448743936",
	}
	response, err := client.AssociateIssues(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 associating/disassociating work items

400

Response to a failed request for associating/disassociating work items

Error Codes

See Error Codes.