• Elastic Cloud Server

ecs
  1. Help Center
  2. Elastic Cloud Server
  3. API Reference
  4. OpenStack Nova APIs
  5. Flavor Management
  6. Querying ECS Flavors

Querying ECS Flavors

Function Description

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

URI

GET /v2/{project_id}/flavors

GET /v2.1/{project_id}/flavors

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

Request

Request parameters

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 request parameters.

Table 2 Request parameters

Parameter

Type

Mandatory

Description

minDisk

String

No

Specifies the minimum disk specification in the unit of GB. Only the ECSs with the disk specification greater than or equal to the minimum specification can be queried.

minRam

String

No

Specifies the minimum RAM in the unit of MB. Only the ECSs with the RAM specification greater than or equal to the minimum specification can be queried.

sort_key

String

No

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

String

No

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

Response

Response parameters

Table 3 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Description

id

String

Specifies the flavor ID.

links

List(Dict)

Specifies the shortcut link of the ECS flavor.

For details, see Table 4.

name

String

Specifies the flavor name.

Table 4 links field description

Parameter

Type

Description

rel

String

Specifies the shortcut link marker name.

href

String

Specifies the shortcut link.

Examples

  • Example request
    GET /v2/9c53a566cb3443ab910cf0daebca90c4/flavors
    GET /v2.1/9c53a566cb3443ab910cf0daebca90c4/flavors
  • Example response
    {
        "flavors": [
            {
                "id": "4",
                "links": [
                    {
                        "href": "http://192.168.82.222:8774/v2/9c53a566cb3443ab910cf0daebca90c4/flavors/4",
                        "rel": "self"
                    },
                    {
                        "href": "http://192.168.82.222:8774/9c53a566cb3443ab910cf0daebca90c4/flavors/4",
                        "rel": "bookmark"
                    }
                ],
                "name": "m1.large"
            },
            {
                "id": "5",
                "links": [
                    {
                        "href": "http://192.168.82.222:8774/v2/9c53a566cb3443ab910cf0daebca90c4/flavors/5",
                        "rel": "self"
                    },
                    {
                        "href": "http://192.168.82.222:8774/9c53a566cb3443ab910cf0daebca90c4/flavors/5",
                        "rel": "bookmark"
                    }
                ],
                "name": "m1.xlarge"
            }
        ]
    }     

Returned Values

See General Request Returned Values.