Sorting

For API requests that return a list, Stax Bill can sort the array of JSON objects as a part of the request. The query string parameters used for this are sortOrder and sortExpression. Both query string parameters must be provided in the URL when using a custom sort scheme.

📘

Example: sort on time

GET https://secure.fusebill.com/v1/customers?pageSize=100&pageNumber=0&sortOrder=Descending&sortExpression=createdTimestamp

This call returns 100 customer entities ordered from the most recently created to the 100th most recently created customer. sortOrder is an enum that can be either “Ascending” or “Descending”. sortExpression is a query parameter name. Any query parameter name that can be used for string matching or date filtering can be used for sortExpression.

📘

Example: sort on string

GET https://secure.fusebill.com/v1/customers?pageSize=100&pageNumber=0&sortOrder=Ascending&sortExpression=firstName

This call returns 100 customer entities sorted by the lexicographical order of the firstName field. Lexicographical order for a string field goes from null to digits to letters. This would be an ascending order of strings: null, “123”, “234”, “alpha”, “bravo”...

You can verify what's being sorted on by checking the custom response headers X-SortOrder and X-SortExpression