Page 1 of 1

Change the order of data from the API.

Posted: Mon May 01, 2023 6:57 am
by demo
Hii,
I have a query related to API data. I want to change the order of the data that I am getting from the API. I am using API to get data for Specific Mobile Log. So I want to change the order of the data according to DateLogged. Please suggest for this issue that How can I resolve it?

Thank You

Re: Change the order of data from the API.

Posted: Tue May 02, 2023 12:20 am
by Sindre
Hi Demo,
Available functions can be different between endpoints but I understand that you are looking at the mobile logs endpoint?

Code: Select all

/api/v1.0/companies/{companyID}/logs/mobileStatus/
For this endpoint you should be able to sort by dateLogged.

Try this for sorting with newest log first:

Code: Select all

api/v1.0/companies/0/logs/mobileStatus/?orderby=-DateLogged
For oldest log first:

Code: Select all

api/v1.0/companies/0/logs/mobileStatus/?orderby=DateLogged
Regards

Re: Change the order of data from the API.

Posted: Tue May 02, 2023 4:18 am
by demo
Thank You for the help. It's working.