Skip to content

Sort

  • To change response order with a particular column name in ascending or descending order.

Ascending order

Change response order with customer_id ascending order value.

URL

  • Schema based API url

    /api/schema/user-path/instance/database/table?sort=customer_id
    

  • schemaless API url

    /api/gen/user-path/instance/database/table?sort=customer_id
    

{
    "data": [
        {
            "customer_id": 1,
            "first_name": "Bob",
            "last_name": "Lin"
        },
        {
            "customer_id": 2,
            "first_name": "Alice",
            "last_name": "Page"
        },
        {
            "customer_id": 3,
            "first_name": "Mallory",
            "last_name": "Brown"
        },
        {
            "customer_id": 4,
            "first_name": "Eve",
            "last_name": "Mathly"
        },
        {
            "customer_id": 5,
            "first_name": "Eve",
            "last_name": "Page"
        }
    ]
}

Descending order

Change response order with customer_id descending order value.

URL

/api/gen/user-path/instance/database/table?sort=-customer_id
{
    "data": [
        {
            "customer_id": 5,
            "first_name": "Eve",
            "last_name": "Page"
        },
        {
            "customer_id": 4,
            "first_name": "Eve",
            "last_name": "Mathly"
        },
        {
            "customer_id": 3,
            "first_name": "Mallory",
            "last_name": "Brown"
        },
        {
            "customer_id": 2,
            "first_name": "Alice",
            "last_name": "Page"
        },
        {
            "customer_id": 1,
            "first_name": "Bob",
            "last_name": "Lin"
        }
    ]   
}