Sort by modification_date

Is there any way to sort any of the Infusionsoft API entities by their last updated date (modification_date) in descending order? Looking to get a list of entities in descending order with the most recent entity first.

Some entities, for example tasks, have an order field as an option to sort objects but I get the following error when I try to use modification_date:

Invalid or unsupported ordering requested: modification_date

Other entities, for example campaigns, have the option to order by creation date but not the modification date.

I assume from my testing that the entities are not able to be sorted by the most recent updated date but I wanted to double check in case I was missing something. Thank you!

use the data object method dsQueryOrderBy and search on the LastUpdated, datetime field

Thank you for your suggestion! I’m using Node JS and there isn’t an sdk for Node JS. Looks like the dsQueryOrderBy data object method is available for the php sdk. Doesn’t appear there’s any way to sort with the basic REST API functionality. Good to know there’s an option with the php sdk at least.

To use node (or any js framework) you will need an endpoint to get responses from. In the case of using REST, you have that endpoint already there. But REST is still being developed and not all the functions you may want are available.

In the case of contacts or tasks, the list method supported by GET has an orderBy field. For other options not yet supported by REST, you would need to create your own endpoint using the SDK and then make request to it just as you would to REST.

You can, in fact, simulate REST with these endpoints by managing the state based actions of REST using the SDK, if you wished to take it that far.

1 Like