Sorting

As well as using queries to limit response data, you can also use the orderBy parameter to specify the order of records in the response.

Ascending Order

By default, results are returned in ascending order. For example, if you want to return a list of transactions in ascending order, oldest first, use the following syntax: {parameter}={value}. In this case, orderBy=date.

curl --request GET \
  --url https://api.railz.ai/balanceSheets?businessName=Demo&reportFrequency=month&serviceName=quickbooks&orderBy=date \
  --header 'Accept: application/json'

Descending Order

To return results in descending order you simply prepend a - to the parameter value. For example, to return the same list of transactions, this time with the newest transactions first, use the following syntax: orderBy=-date.

curl --request GET \
  --url https://api.railz.ai/balanceSheets?businessName=Demo&reportFrequency=month&serviceName=quickbooks&orderBy=-date \
  --header 'Accept: application/json'

Sorting Results from a Custom Query

You can also order the results returned by any custom queries that you've written. For example, you might regularly run a query that returns all Chequing transactions and order the list in ascending order, that is the oldest transactions first:

curl --request GET \
  --url https://api.railz.ai/transactions?businessName=Demo&serviceName=quickbooks&accountName=Chequing&orderBy=date \
  --header 'Accept: application/json'