Field Sorting Capability in Frappe Rest Api

-Is there a sorting capability in Frappe Rest Api?

I want, for example, to get a list of Customers ordered by name.


and get the json response ordered by Customer Name

Thanks in advance

Not sure if this is the best way, but here’s how I’d do it:

You might try building a server-side RPC call that queries the table directly - you could then use the usual SQL to order or format the data any way you wanted.

Here’s a very simple routine I put in my for my custom app that queries the Files table,

def getFilesDict():
document = frappe.db.sql(“select * from tabFile order by file_name desc”, as_dict=True)
return document

I can then call it with api/method/customapp.api.getFilesDict


As of now you cannot explicitly define any sorting options for the default ReST APIs. You do receive them by the order of creation at the moment. Any sorting has to be handled by the client thereafter.