I’m trying to get all the contacts and I used Get all contacts API. Everything is fine except I cannot find an option to get the latest data first (order by addedAt). Please help!!!
@thethlaing Not sure if the API itself comes with the ability to sort.
Otherwise, perhaps you can deal with it at code level. What I’d do is:
- Decode JSON (to array)
- Do sorting on the array based on key (addedAt); You can do custom sorting with PHP on datetime (http://stackoverflow.com/questions/8121241/sort-array-based-on-the-datetime-in-php)
Hope it helps!
@jerome.kwek is correct in that the Contacts API doesn’t support sorting, but we do have an endpoint that you can use to get contacts ordered by when they were created:
For example, this will get you the most recently created contacts from the demo portal:
This endpoint follows the same rules as getting recently updated contacts, so you’ll need to use the 1vid-offset
andtime-offset` to page through the records.