Synchronization

Applications, especially data-driven apps, should use updated information all the time and should be able to work even without an internet connection. To do this, the client app or database must synchronize with Contentstack regularly, and especially after a period of internet disconnection.

Contentstack Synchronization helps you do just that.

Syncing content between Contentstack server and your local server, database, or device is easy. Contentstack Synchronization, which includes Sync APIs as well as other powerful syncing tools, provides something for every kind of content synchronization needs.

Under the Contentstack Synchronization umbrella, we provide the following:

  • Sync API: Get all content or only incremental (delta) updates, anywhere, anytime
  • DataSync (New): Sync Contentstack data with your database (Filesystem, MongoDB)
  • SDKs with Sync API Support: Build power apps using our SDKs which now support Sync APIs
  • Mobile Sync Helpers: Create offline apps by storing content on the device’s local storage

Let’s learn more about these components.

Sync API

The Sync API is part of our Content Delivery APIs and can be used to sync complete data and fetch incremental updates subsequently (through delta updates).  It provides three main synchronization requests:

Initial sync: This request is used to sync complete data, i.e., the content of a stack that has ever been published to the specified environment. This is usually used to load data during app initialization when the user uses the app for the very first time. You can use various queries to get the results of specific content types or starting from a specific date or both

Subsequent sync: This request helps you keep your app up-to-date by providing delta updates. If initial sync is done, this request fetches only the content that was published since the last sync.

Pagination token: If the response of the initial sync or subsequent sync requests contains more than 100 records, the response is paginated. You will get the first 100 records in the response along with a pagination token, which you can use to fetch subsequent batches of data. 

Read our Sync API documentation to get started with the Sync API.

Contentstack DataSync

Contentstack DataSync allows you to synchronize Contentstack data with your database (MongoDB, Filesystem, etc.). It consists of tools that we have combined to give you the best synchronization possible.

With DataSync, whenever a piece of content is published, deleted or updated, a copy of the content changes is saved in your database. Subsequently, all page requests are served directly from your database, instead of from Contentstack through APIs.

Read more about DataSync to understand this tool and learn about the things that you can do with it.

Using the Sync API with SDKs

Most of our content delivery SDKs support Sync API. Click the links below to understand how to use the Sync API with our SDKs.

You can also refer to our SDK-specific playground apps to get started with Contentstack Sync API. You can clone these apps and try out the APIs to get a first-hand experience of the synchronization methods.

Mobile Sync Helpers

Contentstack provides persistence libraries to help you save data on the local database of your sync app, and lets your app work offline as well. These libraries contain methods that are required to map data fields of your content types and Realm

We have created a couple of example applications that demonstrate the usage of data persistence with our SDKs. Use the links below to navigate to the required pages:

Was this article helpful?
top-arrow