Change the order of data from the API.

Posts about the simPRO API. Help/support/how-to etc.
Forum rules
  • Check the documentation first. Before posting questions, please check the documentation to ensure it doesn't already cover what you need.
  • No spam. All automated messages, advertisements, and links to competitor websites will be deleted immediately.
  • Post in relevant sub-forums only. Messages posted in the wrong topic area will be removed and placed in the correct sub-forum by moderators.
  • Respect other users. No flaming or abusing fellow forum members. Users who continue to post inflammatory, abusive comments will be deleted from the forum after two warnings are issued by moderators.
  • Harassment. No threats or harassment of other users will be tolerated. Any instance of threatening or harassing behavior is grounds for deletion from the forums.
  • Adult content. No profanity or pornography is allowed. Posts containing adult material will be deleted.
  • Bandwidth. All images and signatures must be 500 x 500 pixels or smaller. Posts containing over-sized images and signatures will be removed.
  • Illegal content. No re-posting of copyrighted materials or other illegal content is allowed. Any posts containing illegal content or copyrighted materials will be deleted.
Post Reply
demo
Posts: 17
Joined: Sat May 14, 2022 12:24 pm

Change the order of data from the API.

Post by demo » Mon May 01, 2023 6:57 am

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
Sindre
Posts: 493
Joined: Wed Apr 20, 2022 4:51 am
Location: Brisbane

Re: Change the order of data from the API.

Post by Sindre » Tue May 02, 2023 12:20 am

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
Sindre
API Developer | Simpro Software Group
demo
Posts: 17
Joined: Sat May 14, 2022 12:24 pm

Re: Change the order of data from the API.

Post by demo » Tue May 02, 2023 4:18 am

Thank You for the help. It's working.
Post Reply