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

Querying Project Members

Function

This API is used to query project members.

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

List

-

  • codeartsreq:Model

  • codeartsreq:ProjectId

-

-

URI

GET /v1/ipdprojectservice/projects/{project_id}/users

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

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

status

String

Definition

Response status.

Range

  • success: The response is successful.

  • error: The response fails.

message

String

Failure message.

result

Array of UserVO objects

User information list.

Table 3 UserVO

Parameter

Type

Description

user_id

String

Definition

User ID.

Range

N/A

user_num_id

Integer

Definition

Short ID of a user.

Range

N/A

user_name

String

Definition

Username.

Range

N/A

domain_id

String

Definition

ID of the domain to which the user belongs.

Range

N/A

domain_name

String

Definition

Tenant name.

Range

N/A

nick_name

String

Definition

User alias.

Range

N/A

role_id

String

Definition

Role ID. If a user has multiple roles in a project, use commas (,) to separate the values.

Range

N/A

role_name

String

Definition

Role name. If a user has multiple roles, use commas (,) to separate the values.

Range

N/A

role_code

String

Definition

Role code. If a user has multiple roles, use commas (,) to separate the values.

Range

N/A

Status code: 400

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

Querying project members of the project whose ID is 7a165263bedc4f589b017d909d04a067

GET https://{endpoint}/v1/ipdprojectservice/projects/7a165263bedc4f589b017d909d04a067/users

Example Responses

Status code: 200

{
  "status" : "success",
  "message" : "",
  "result" : [ {
    "user_id" : "a71eed54261e4c9888f34dfbb777d423",
    "user_num_id" : null,
    "user_name" : "testUser1",
    "domain_id" : "aae03ca0d6814951980945b6eeca56cd",
    "domain_name" : null,
    "nick_name" : "",
    "role_id" : "3013fa41bf734685af16afe49d21240a",
    "role_name" : "Developer",
    "role_code" : "Developer"
  }, {
    "user_id" : "c2d89e38a64a466f8f945f595df4402d",
    "user_num_id" : null,
    "user_name" : "ForTest",
    "domain_id" : "aae03ca0d6814951980945b6eeca56cd",
    "domain_name" : null,
    "nick_name" : "ForTestForTest",
    "role_id" : "6806b0e509054db593f4f98eb4d8cf64,a4691fdc09484b8ab1e4e2b86de4fe76",
    "role_name" : "Project admin,Project manager",
    "role_code" : "Project manager,project_admin"
  } ]
}

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

    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();
        ListProjectUsersRequest request = new ListProjectUsersRequest();
        request.withProjectId("{project_id}");
        try {
            ListProjectUsersResponse response = client.listProjectUsers(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
# 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 = ListProjectUsersRequest()
        request.project_id = "{project_id}"
        response = client.list_project_users(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
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.ListProjectUsersRequest{}
	request.ProjectId = "{project_id}"
	response, err := client.ListProjectUsers(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.