Sorting
You'd want to order information alphabetically. WhereAPI provides an order_by
query param you can use to order collections of data. Here's an a request for all the states in Nigeria ordered alphabetically.
Your response would like this
#
Sorting DirectionAding a field to the order_by
query param automatically orders the response in ascending order. If we wanted to order by the name
field in descending order, we'll modify the query by adding a -
sign to the beginning of the field name. (states?order_by=-name
)
This orders the states by descending order of names.
info
You can currently sort by the name
field on all endpoints returning multiple entities. This is to keep the implementation simple. Sorting for other fields will be added later.