• Native OpenStack API

noa
  1. Help Center
  2. Native OpenStack API
  3. API Reference
  4. Neutron
  5. Common Information
  6. Sequencing Query Results

Sequencing Query Results

Neutron APIs v2.0 enable the system to sort query results based on customized keys by adding the sort_key and sort_dir parameters to the URL of the list request. sort_key specifies the parameters based on which queried results are sorted, and sort_dir specifies the ascending (asc) or descending (desc) sequence. Neutron APIs v2.0 support sorting based on multiple conditions. In such a case, the number of sort_key parameters must be the same as that of the sort_dir parameters. Otherwise, error code 400 will be returned.

Request Example

GET
/v2.0/networks?sort_key=name&sort_dir=asc& sort_key= status &sort_dir=desc

Response Example

{
    "networks": [
        {
            "status": "ACTIVE",
            "subnets": [],
            "name": "liudongtest ",
            "admin_state_up": false,
            "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
            "id": "60c809cb-6731-45d0-ace8-3bf5626421a9"
        },
        {
            "status": "ACTIVE",
            "subnets": [
                "132dc12d-c02a-4c90-9cd5-c31669aace04"
            ],
            "name": "publicnet",
            "admin_state_up": true,
            "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
            "id": "9daeac7c-a98f-430f-8e38-67f9c044e299"
        },
        {
            "status": "ACTIVE",
            "subnets": [
                "e25189a8-54df-4948-9396-d8291ffc92a0"
            ],
            "name": "testnet01",
            "admin_state_up": true,
            "tenant_id": "6fbe9263116a4b68818cf1edce16bc4f",
            "id": "3d42a0d4-a980-4613-ae76-a2cddecff054"
        }
    ]
}