Arlo

Entity synchronisation best practice

This article describes a reliable algorithm to use in order to use our Auth API for finding the latest changed records for a given entity.

The algorithm will be described in the context of the Contact resource, although it is applicable to all of Arlo's main resources.

Two data points are required to be stored in order for the data to be pulled:

  • ContactModifiedDateTime
  • ContactID

For the initial data pull these two values aren't needed and you can pull directly ordering by LastModifiedDateTime and ContactID as shown below:

/api/2012-02-01/auth/resources/contacts/?orderby=LastModifiedDateTime ASC,ContactID ASC
    

This will pull the default page size of records (100). For the last record returned, the LastModifiedDateTime and the ContactID need to be stored so they can be used for the next query:

/api/2012-02-01/auth/resources/contacts/?filter=(CreatedDateTime gt datetime('2013-07-16T23:57:12.943Z') OR LastModifiedDateTime gt datetime('2013-07-16T23:57:12.943Z') ) OR (LastModifiedDateTime eq datetime('2013-07-16T23:57:12.943Z') AND ContactID gt 12095)&orderby=LastModifiedDateTime ASC,ContactID ASC
    

Again you store the LastModifiedDateTime and the ContactID need to be stored so they can be used for the next query. You can then continue to pull pages until no more pages are returned on a schedule that suits your requirements.