Updated on 2023-07-05 GMT+08:00

Listing Projects

Function

This API can be used by the administrator to list the projects accessible to a specified IAM user or used by an IAM user to list accessible projects.

The API can be called using both the global endpoint and region-specific endpoints. For IAM endpoints, see Regions and Endpoints.

URI

GET /v3/users/{user_id}/projects

Table 1 URI parameters

Parameter

Mandatory

Type

Description

user_id

Yes

String

IAM user ID. For details about how to obtain a user ID, see Obtaining Account, IAM User, Group, Project, Region, and Agency Information.

Request Parameters

Table 2 Parameters in the request header

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Fill application/json;charset=utf8 in this field.

X-Auth-Token

Yes

String

Access token issued to a user to bear its identity and permissions.

If the administrator is requesting to list the projects of a specified IAM user. see Actions.

If an IAM user is requesting to list accessible projects, the user token (no special permission requirements) of the user is required.

Response Parameters

Table 3 Parameters in the response body

Parameter

Type

Description

links

Object

Resource link information.

projects

Array of objects

Project information.

Table 5 projects

Parameter

Type

Description

is_domain

Boolean

The value is false.

description

String

Description of the project.

links

Object

Project resource link.

enabled

Boolean

Enabling status of the project.

id

String

Project ID.

parent_id

String

ID of the specified subproject or account ID of a specified system project, for example, the ap-southeast-1 project.

domain_id

String

Account ID of the project.

name

String

Project name.

Example Request

Request for querying project information of a specified IAM user

GET https://iam.myhuaweicloud.com/v3/users/{user_id}/projects

Example Response

Status code: 200

The request is successful.

{
    "projects": [
        {
            "domain_id": "d78cbac186b744899480f25bd02...",
            "is_domain": false,
            "parent_id": "d78cbac186b744899480f25bd0...",
            "name": "ap-southeast-1",
            "description": "",
            "links": {
                "next": null,
                "previous": null,
                "self": "https://iam.myhuaweicloud.com/v3/projects/06f1cd8ea9800ff02f26c003d93..."
            },
            "id": "06f1cd8ea9800ff02f26c003d93...",
            "enabled": true
        },
        {
            "domain_id": "d78cbac186b744899480f25bd02...",
            "is_domain": false,
            "parent_id": "d78cbac186b744899480f25bd0...",
            "name": "MOS",
            "description": "",
            "links": {
                "next": null,
                "previous": null,
                "self": "https://iam.myhuaweicloud.com/v3/projects/babf0605d15b4f9fbcacc6a8ee0f8d84"
            },
            "id": "babf0605d15b4f9fbcacc6a8ee0f8d84",
            "enabled": true
        }
    ],
    "links": {
        "next": null,
        "previous": null,
        "self": "https://iam.myhuaweicloud.com/v3/users/7116d09f88fa41908676fdd4b039e95b/projects"
    }
}

Status Codes

Status Code

Description

200

The request is successful.

400

Invalid parameters.

401

Authentication failed.

403

Access denied.

404

The requested resource cannot be found.

405

The method specified in the request is not allowed for the requested resource.

413

The request entity is too large.

500

Internal server error.

503

Service unavailable.

Error Codes

None