Files
doc-exports/docs/ecs/api-ref/en-us_topic_0065817705.html
wanghuijuan738 8f024b87ae ECS API 20251204 version. Adding an API Document.
Reviewed-by: Pristromskaia, Margarita <margarita.pristromskaia@t-systems.com>
Co-authored-by: wanghuijuan738 <wanghuijuan738@huawei.com>
Co-committed-by: wanghuijuan738 <wanghuijuan738@huawei.com>
2025-12-17 11:05:14 +00:00

18 KiB

Listing ECS Flavors

Function

This API is used to list available ECS flavors. After receiving the request, Nova uses nova-api to view the flavors from the database.

URI

GET /v2.1/{project_id}/flavors?minDisk={minDisk}&minRam={minRam}&sort_key={sort_key}&sort_dir={sort_dir}

GET /v2/{project_id}/flavors?minDisk={minDisk}&minRam={minRam}&sort_key={sort_key}&sort_dir={sort_dir}

Table 1 describes the parameters in the URI.
Table 1 Path parameters

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

Parameters in the following table can be used as URI parameters to filter query results. Usage: /v2/{project_id}/flavors?minDisk={minDisk}&minRam={minRam}

Table 2 describes the query parameters.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

minDisk

No

Integer

Specifies the minimum disk size in GiB. Only the ECSs with a disk size greater than or equal to the minimum size can be queried.

minRam

No

Integer

Specifies the minimum memory size in MiB. Only the ECSs with the memory size greater than or equal to the minimum size can be queried.

sort_key

No

String

Indicates a sorting field, the default value of which is flavorid.

The value of this parameter can also be name, memory_mb, vcpus, root_gb, or flavorid.

sort_dir

No

String

Specifies the ascending (asc) or descending (desc) sorting. The default value is asc.

Request

None

Response

Table 4 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Description

flavors

Array of objects

Specifies ECS flavors. For details, see Table 4.

flavors_links

Array of objects

Specifies data links for querying the next pages in pagination query. For details, see Table 5.

Table 4 flavors field description

Parameter

Type

Description

id

String

Specifies the flavor ID.

links

Array of objects

Specifies the shortcut link of the ECS flavor.

For details, see Table 5.

name

String

Specifies the flavor name.

Table 5 links field description

Parameter

Type

Description

rel

String

Specifies the shortcut link marker name.

href

String

Specifies the shortcut link.

Example Request

List available ECS flavors.

GET https://{endpoint}/v2/743b4c0428d94531b9f2add666642e6b/flavors
GET https://{endpoint}/v2.1/743b4c0428d94531b9f2add666642e6b/flavors

Example Response

{
    "flavors": [
        {
            "id": "s3.xlarge.1",
            "links": [
                {
                    "href": "https://compute.region.example.com/v2.1/743b4c0428d94531b9f2add666642e6b/flavors/s3.xlarge.1",
                    "rel": "self"
                },
                {
                    "href": "https://compute.region.example.com/743b4c0428d94531b9f2add666642e6b/flavors/s3.xlarge.1",
                    "rel": "bookmark"
                }
            ],
            "name": "s3.xlarge.1"
        },
        {
            "id": "s3.xlarge.2",
            "links": [
                {
                    "href": "https://compute.region.example.com/v2.1/743b4c0428d94531b9f2add666642e6b/flavors/s3.xlarge.2",
                    "rel": "self"
                },
                {
                    "href": "https://compute.region.x.com/743b4c0428d94531b9f2add666642e6b/flavors/s3.xlarge.2",
                    "rel": "bookmark"
                }
            ],
            "name": "s3.xlarge.2"
        }
    ]
}