A common use case is to sync Card content from Guru to an external system. This can be accomplished using the List Cards endpoint.
curl utility will be used to illustrate how to accomplish this. Authentication details are removed for brevity.
First, an initial export is done using a wide open query.
This will return an array of all card objects. In most accounts, the results from this call will be paged. See the Paging documentation to see how to process all results.
Once a full export is done, a filtered export can be performed to capture all changes to card content using the card's
lastModified field, which indicates the last time the card was modified. For this example, assume the initial export was done on January 15th, 2016 at 8am UTC time. In ISO-8601 format, this date is
2016-01-15T08:00:00.000+00:00. For the first sync of changes, use the
lastModified filter of the List Cards endpoint to make a query
lastModified >= 2016-01-15T08:00:00.000+00:00 (this query will be URL encoded in the example below).
curl "https://api.getguru.com/api/v1/search/query?q=lastModified >= 2016-01-15T08:00:00.000+00:00"
This will return an array of all cards that have been modified since January 15th at 8am UTC. Again, results may be paged. Record the date/time of the sync and use that date/time in the next query. For example, if the last sync was performed on January 16th at 10am UTC, that date would be used in the next sync call (
lastModified >= 2016-01-16T10:00:00.000+00:00).
Continuing to do periodic syncs like this will ensure that all changes are properly exported.
NOTE: The filtered export will bring over existing Card IDs. It's on the third-party app to complete an overwrite of that data if you want to avoid creating duplicate Cards.
Updated over 1 year ago