Syncing Cards

A common use case is to sync Card content from Guru to an external system. This can be accomplished using the List Cards endpoint.

The curl utility will be used to illustrate how to accomplish this. Authentication details are removed for brevity.

Initial Export

First, an initial export is done using a wide open query.

curl  "https://api.getguru.com/api/v1/search/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.

Periodic Sync of Changes

Once the initial export is done, a periodic sync 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%20%3E%3D%202016-01-15T08%3A00%3A00.000%2B00%3A00"

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.