Help Center/ CodeArts Req/ API Reference/ API/ IPD Work Item Process/ Transitioning the Work Item Status
Updated on 2026-10-27 GMT+08:00

Transitioning the Work Item Status

Function

This API is used to transition the status of a work item.

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}/work-item/flow/transfer

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

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

10 to 32,768 characters

Default Value

N/A

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

id

No

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

N/A

Default Value

N/A

issue_category

Yes

String

Definition

Work item type.

Constraints

N/A

Range

RR, IR, AR, SR, Bug, FE, Task, US, Epic, and SF

Default Value

N/A

flow_code

Yes

String

Definition

Work item transition code. It can be obtained by calling the API for querying work item process information.

The next_flow array in the response body is the workflow transition line. You can find the matching transition line based on the current status from_code and target status to_code. The value of the code field of the transition line is the work item transition code.

Constraints

N/A

Range

N/A

Default Value

N/A

issue_ids

No

Array of strings

Definition

Unique ID array of work items. 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

N/A

Default Value

N/A

process_context

No

Map<String,Object>

Definition

Transition context.

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

Status code.

Range

N/A

message

String

Definition

Response message.

Range

N/A

result

WorkItemFlowInfoVO object

Definition

Response body of workflow details.

Range

N/A

Table 5 WorkItemFlowInfoVO

Parameter

Type

Description

process_instance

WorkItemFlowProcessInstanceVO object

Definition

Work item workflow instance information.

Range

N/A

next_flow

Array of FlowsInfoVO objects

Definition

Valid transition lines.

Range

N/A

Table 6 WorkItemFlowProcessInstanceVO

Parameter

Type

Description

process_instance

WorkItemFlowProcessInstanceVO object

Definition

Work item workflow instance information.

Range

N/A

next_flow

Array of FlowsInfoVO objects

Definition

Valid transition lines.

Range

N/A

id

String

Definition

ID of a work item workflow instance.

Range

N/A

flow_state

Integer

Definition

Whether a workflow instance is suspended.

Range

1: running

2: suspended

Table 7 FlowsInfoVO

Parameter

Type

Description

code

String

Definition

Transition line code.

Range

N/A

name

String

Definition

Transition line name.

Range

N/A

description

String

Definition

Transition line description.

Range

N/A

from_code

String

Definition

Code of the current workflow node.

Range

N/A

to_code

String

Definition

Code of the target workflow node.

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

POST https://{endpoint}/v1/ipdprojectservice/projects/39d30be0842e4e5d8e28ee7e1712c6a2/work-item/flow/transfer

{
  "id" : "1135239465657217024",
  "issue_category" : "Bug",
  "flow_code" : "__virtual_Analyse__2__Fixed"
}

Example Responses

Status code: 200

{
  "status" : "success",
  "message" : null
}

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

    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();
        TransferWorkItemFlowRequest request = new TransferWorkItemFlowRequest();
        request.withProjectId("{project_id}");
        WorkItemFlowRequestBody body = new WorkItemFlowRequestBody();
        body.withFlowCode("__virtual_Analyse__2__Fixed");
        body.withIssueCategory("Bug");
        body.withId("1135239465657217024");
        request.withBody(body);
        try {
            TransferWorkItemFlowResponse response = client.transferWorkItemFlow(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
# 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 = TransferWorkItemFlowRequest()
        request.project_id = "{project_id}"
        request.body = WorkItemFlowRequestBody(
            flow_code="__virtual_Analyse__2__Fixed",
            issue_category="Bug",
            id="1135239465657217024"
        )
        response = client.transfer_work_item_flow(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
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.TransferWorkItemFlowRequest{}
	request.ProjectId = "{project_id}"
	flowCodeWorkItemFlowRequestBody:= "__virtual_Analyse__2__Fixed"
	issueCategoryWorkItemFlowRequestBody:= "Bug"
	idWorkItemFlowRequestBody:= "1135239465657217024"
	request.Body = &model.WorkItemFlowRequestBody{
		FlowCode: &flowCodeWorkItemFlowRequestBody,
		IssueCategory: &issueCategoryWorkItemFlowRequestBody,
		Id: &idWorkItemFlowRequestBody,
	}
	response, err := client.TransferWorkItemFlow(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

Success response.

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.