Web Studio is here! An enhanced experience to make it easier to create, preview, and collaborate on your website contentLearn More
The Content Sync API makes it easy to keep a content cache or copy of Agility content so it can be readily accessible to your digital solution without calling home to Agility.
The Sync API endpoint is part of the Content Fetch API and is available for all customers.
These are the general steps a developer would need to synchronize content from Agility CMS to another system.
Step one: Setup a Webhook in Agility so that you can be notified when changes to our CMS are made.
Step two: When a webhook request is received, make a call to the Sync API :
curl -X GET "https://api.aglty.io/4582b5fa-u/fetch/en-us/sync/items?syncToken=0&pageSize=500" -H "accept: application/json" -H "APIKey: xxxxxxxxxx"
Your first call to the API will have a syncToken
of 0
.
The above call will return all content from the CMS in a paginated manner (max 500 per request), and provide the next syncToken
to use.
Step three: Save the results into a local filesystem, database, or Redis Cache
Step four: Continue to query to the Sync API until no results are returned or syncToken=0
- this means you are up to date.
Step five: Store the last syncToken
you had, so that the next time you call the API you'll get the content that has changed since your last syncToken
Agility CMS provides a JS SDK to handle syncing and managing for your sync token as well as providing interfaces for storing and accessing previously synced content.