Updated on 2024-04-16 GMT+08:00

Querying Resources Added to an Enterprise Project

Function

This API is used to query details about resources added to an enterprise project.

URI

POST /v1.0/enterprise-projects/{enterprise_project_id}/resources/filter

For detailed about the parameters, see Table 1.
Table 1 Parameter in the URI

Name

Mandatory

Type

Description

enterprise_project_id

Yes

String

Specifies the enterprise project ID.

You can obtain the ID by using API Querying the Enterprise Project List.

Request

  • Parameter description
    Table 2 Parameters in the request

    Name

    Mandatory

    Type

    Description

    limit

    No

    Integer

    Specifies the number of records to be queried. The default value is 1000. The maximum value is 1000, and the minimum value is 1.

    offset

    No

    Integer

    Specifies the index position, which starts from the next data record specified by offset. The value must be a number and cannot be a negative number. The default value is 0.

    projects

    No

    List<String>

    Specifies the project IDs. You can obtain the project IDs from Obtaining a Project ID. This parameter can be ignored when the transferred resource is a global resource, such as cdn. This parameter is mandatory when the transferred resource type is a region-specific resource type, such as ECS and EVS disk.

    resource_types

    Yes

    List<String>

    Specifies the resource type list. The value of this parameter is case-sensitive. For example, ecs, scaling_group, images, disk, vpcs, security-groups, shared_bandwidth, cdn, and eip.

    For details, see Resource Types Supported by EPS.

    matches

    No

    List<match>

    Specifies the search field. Key indicates the field to be matched and is fixed at resource_name. Value indicates the value to be matched. If this field is not transferred, no matching condition will be used.

    For details, see Table 3.

  • Match field data structure
    Table 3 Match field data structure description

    Name

    Mandatory

    Type

    Description

    key

    Yes

    String

    Specifies the key. If the matches parameter exists, this parameter is mandatory and is fixed at resource_name.

    value

    Yes

    String

    Specifies the value. The value is the resource name. If the matches parameter is available, this parameter is mandatory and fuzzy search is used by default, for example, message.com. Enter a maximum of 255 characters.

  • Example request
    POST https://{EPS endpoint}/v1.0/enterprise-projects/{enterprise_project_id}/resources/filter
    {
        "projects": [
            "e1eb7c40cbea4c8389cde527594a306d",
            "2345d321da864d6faf2e762647e19f96"
        ],
        "resource_types": [
            "disk"
        ],
        "offset": 0,
        "limit": 10,
        "matches": [
            {
                "key": "resource_name",
                "value": "lhj"
            }
        ]
    }

Response

  • Parameter description
    Table 4 Parameters in the response

    Name

    Type

    Description

    resources

    List<resource>

    Specifies the resource list.

    For details, see Table 5.

    errors

    List<error>

    Specifies the error list.

    For details, see Table 6.

    total_count

    Integer

    Specifies the total number of returned records meeting the requirements.

  • Resource field data structure
    Table 5 Resource field data structure description

    Name

    Type

    Description

    project_id

    String

    Specifies the project ID.

    project_name

    String

    Specifies the enterprise project name.

    resource_type

    String

    Specifies the resource type.

    For details, see Resource Types Supported by EPS.

    resource_id

    String

    Specifies the resource ID.

    resource_name

    String

    Specifies the resource name.

    resource_detail

    Object

    Specifies the resource details.

    enterprise_project_id

    String

    Specifies the enterprise project ID.

  • Error field data structure
    Table 6 Error field data structure description

    Name

    Type

    Description

    project_id

    String

    Specifies the project ID.

    resource_type

    String

    Specifies the resource type.

    For details, see Resource Types Supported by EPS.

    error_code

    String

    Specifies the error code.

    error_msg

    String

    Specifies the error message.

  • Example response
    {
        "resources": [
            {
                "project_id": "e1eb7c40cbea4c8389cde527594a306d",
                "project_name": "XXXX",           //Project name
                "resource_type": "disk",
                "resource_id": "b621f5ae-b5c1-49d7-a660-752c445434b4",
                "resource_name": "lhj1-volume-0001",
                "resource_detail": null,
                "enterprise_project_id": "0"
            },
            {
                "project_id": "e1eb7c40cbea4c8389cde527594a306d",
                "project_name": "XXXX",            //Project name
                "resource_type": "disk",
                "resource_id": "87c9edc9-f66c-48b8-a22f-372b2e22d579",
                "resource_name": "lhj2-volume-0002",
                "resource_detail": null,
                "enterprise_project_id": "0"
            }
        ],
        "errors": [],
        "total_count": 2
    }

Status Codes

For details, see Status Code.

Error Codes

For details, see Error Codes.