1. CC Knowledge Base
  2. For organisers
  3. Custom integrations within your apps

Favourites sync

The favourites sync provides two-way synchronisation of favourited items to another system. This article describes what the favourites sync is and how it can be set up.

What is the favourites sync?

With the favourites sync, you can sync the favourites that users save in an external system to the event app and vice versa. If you for example have a website of 3rd party supplier where it is also possible to save items, you can have the same items saved when that user signs in to the mobile app. Likewise, new items saved on the mobile app are then synced to your website as well.

The synchronisation is based on the fact that a user has successfully signed in and the 3rd party supplier has returned a valid user token that can be used during the synchronisation process.

How to set it up

A program item or any other type of object that should be synchronised needs to contain the following:

  • a unique identifier
  • an action description: either ADD or DELETE
  • an action date: the date it was last modified at its source. Note that timestamps need to be in GMT.

Example:

[{
"item" : "session_21982",
"actionDate" : "2017-05-02T10:45:12.798Z",
"action" : "ADD"
}, {
"item" : "session_114582",
"actionDate" : "2017-05-03T12:15:00.128Z",
"action" : "DELETE"
}]

Besides the object itself, a user token is needed to relate it to a specific user.

For the two-way synchronisation, two API endpoints are used.

GET request

The first one is an authenticated GET request, that is used when processing incoming favourites. The action and action date are compared to the existing action and action date. If an incoming item (with the same unique id) has a newer date, it will replace the action and action date. 

The request has the following format:

  • method: GET,
  • host: https://yourserver.com
  • path: /getUserFavorites,
  • headers: Authorization: 'Bearer '+ token_obtained_from_user (if we use a bearer authentication OAuth, otherwise some user identification mechanism) 

If a read-only synchronisation (so not two-way) is required, it is enough to only implement this method.

POST request

The second API endpoint updates the 3rd party API through a POST request. The request has the following format:

  • method: POST,
  • host: https://yourserver.com
  • path: /postUserFavorites,
  • headers: Authorization: 'Bearer '+ token_obtained_from_user (if we use a bearer authentication OAuth2, otherwise some user identification mechanism)