Help Center/ Identity and Access Management/ API Reference/ API/ Project Management/ Listing Projects Accessible to an IAM User
Updated on 2024-11-18 GMT+08:00

Listing Projects Accessible to an IAM User

Function

This API is used to list the projects in which resources are accessible to a specified IAM user.

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

Debugging

You can debug this API in API Explorer.

URI

GET /v3/auth/projects

Request Parameters

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

IAM user token (no special permission requirements)

Response Parameters

Table 2 Parameters in the response body

Parameter

Type

Description

links

Object

Resource link information.

projects

Array of objects

Project information.

Table 4 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 the projects accessible to a specified IAM user

GET https://iam.myhuaweicloud.com/v3/auth/projects

Example Response

Status code: 200

The request is successful.

{
    "projects": [
        {
            "domain_id": "d78cbac186b744899480f25bd02...",
            "is_domain": false,
            "parent_id": "d78cbac186b744899480f25bd022...",
            "name": "af-south-1",
            "description": "",
            "links": {
                "self": "https://iam.myhuaweicloud.com/v3/projects/06f1cbbaf280106b2f14c00313a9d065"
            },
            "id": "06f1cbbaf280106b2f14c00313a9...",
            "enabled": true
        },
        {
            "domain_id": "d78cbac186b744899480f25bd02...",
            "is_domain": false,
            "parent_id": "d78cbac186b744899480f25bd022...",
            "name": "",
            "description": "",
            "links": {
                "self": "https://iam.myhuaweicloud.com/v3/projects/065a7c66da0010992ff7c0031e5a5e7d"
            },
            "id": "065a7c66da0010992ff7c0031e5a5e7d",
            "enabled": true
        }
    ],
    "links": {
        "self": "https://iam.myhuaweicloud.com/v3/auth/projects"
    }
}
  • When project-level services are authorized, the authorized projects are returned.
  • If all resources are authorized, all projects of the user are returned.
  • If a global service is authorized or no service is authorized, no project is returned.

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