
How to sort /Commerce/SalesOrders/GetInvoices API response in descending order?
Hi All,
I’m trying to get the latest invoices using the following RetailServer API:
{{baseUrl}}/Commerce/SalesOrders/GetInvoices?$top=4&$skip=0
I attempted to sort the results by invoice date in descending order using:
{{baseUrl}}/Commerce/SalesOrders/GetInvoices?$top=4&$orderby=INVOICEDATE desc
However, I’m getting the following error:
"TypeName": "CommerceException", "Exception": { "ErrorResourceId": "Microsoft_Dynamics_Commerce_Runtime_HeadquarterCommunicationFailure", "LocalizedMessage": "A connection to headquarters could not be established. This may be due to Retail Real-time Service is not running properly or the trusted certificate used by Real-time Service is missing or expired" }
👉 Note: RTS is working perfectly in all other scenarios.
Can someone please guide me on how to properly sort the response of GetInvoices API in descending order?