Skip to content

Data retrieval with Sorting

Data retrieval and search API can request the server to return sorted data. Data can be sorted by one or more columns. The sorting direction can be either ascending (default) or descending for each individual column. To request sorting with the REST API use the sortBy parameter in a data retrieval request:

https://api.backendless.com/<application-id>/<REST-api-key>/data/<table-name>?sortBy=prop1,prop2

sortBy can be used with all other parameters supported by Backendless. The following sample request retrieves objects from the Person table sorted by the name (descending order) and age (ascending order) columns:

curl "https://api.backendless.com/application-id/REST-api-key[`/data/Person?sortBy=name%20desc%2Cage%20asc`](/data/Person?sortBy=name%20desc%2Cage%20asc)"

Important

The descending sorting order can be requested by adding DESC to the name of the column (separated by space).