0

I am using the below Rest api to fetch all orders in desc i.e the latest on top but its not working

index.php/rest/V1/orders?searchCriteria=all&searchCriteria[sortOrders][0][field]=order_id&searchCriteria[sortOrders][0][direction]=ASC
0

By default result will be ASC order i.e oldest order first

If you need the latest order, You need to set DESC order in search Criteria

You can try below code:

index.php/rest/V1/orders?searchCriteria=all&searchCriteria[sortOrders][0][field]=entity_id&searchCriteria[sortOrders][0][direction]=DESC

Hope above will help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.