• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Nova
  5. ECSs
  6. Listing Servers

Listing Servers

Function Description

This interface is used to query ECSs.

URI

  • URI format

    GET /v2/{tenant_id}/servers{?changes-since,image,flavor,name,status,limit,marker,not-tags,reservation_id}

    GET /v2.1/{tenant_id}/servers{?changes-since,image,flavor,name,status,limit,marker,not-tags,reservation_id}

  • Parameter description

    Parameter

    Mandatory

    Description

    tenant_id

    Yes

    Specifies the tenant or project ID.

Request

Parameter

Mandatory

Type

Description

changes-since

No

String:DateTime

Specifies the timestamp when the ECS status was updated last time. The format complies with ISO 8601 standards, for example:

CCYY-MM-DDThh:mm:ss+/-hh:mm

NOTE:

ECSs in deleted state can be queried.

image

No

String

Specifies the image ID.

When image is used as a filter criterion, other filter criteria and paging criteria are not supported. If both the image and other filter criteria are specified, the image filter criterion prevails. If the query criteria do not contain the image filter criterion, interface functions are not restricted.

flavor

No

String

Specifies the ECS type ID.

name

No

String

Specifies the ECS name.

status

No

String

Specifies the ECS status.

Options:

ACTIVE, BUILD, ERROR, HARD_REBOOT, MIGRATING, REBOOT, RESIZE, REVERT_RESIZE, SHELVED, SHELVED_OFFLOADED, SHUTOFF, UNKNOWN, and VERIFY_RESIZE

limit

No

Integer

Specifies the upper limit on the number of returned results.

marker

No

String

Specifies the marker that points the ECS ID. The query will start from its next ID.

not-tags

No

String

Queries ECSs whose tag field does not contain the specified value.

reservation_id

No

String

Specifies the ID returned when ECSs are created in a batch. This parameter is used to query ECSs created in a batch.

Response

Parameter

Type

Description

servers

List data structure

Specifies the ECSs to be queried. For details, see Table 1.

Table 1 servers field description

Parameter

Type

Description

name

String

Specifies the ECS name.

id

String

Specifies an ECS uniquely.

links

List data structure

Specifies ECS shortcut links. For details, see Table 2.

Table 2 links field description

Parameter

Type

Description

rel

String

Specifies the shortcut link marker name.

href

String

Specifies the shortcut link.

Example response

{
    "servers": [
        {
            "id": "616fb98f-46ca-475e-917e-2563e5a8cd19", 
            "links": [
                {
                    "href": "http://openstack.example.com/v2/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19", 
                    "rel": "self"
                }, 
                {
                    "href": "http://openstack.example.com/openstack/servers/616fb98f-46ca-475e-917e-2563e5a8cd19", 
                    "rel": "bookmark"
                }
            ], 
            "name": "new-server-test"
        }
    ]
}

Returned Value

See General Request Returned Values.