Skip to main content

On demand synchronisation

Description

Synchronizations are asynchronous jobs. They are used to retrieve new user data: balance, transaction list, detection of new bank accounts and financial products. The duration of a synchronization is determined by several factors: quality of partner services, number of connections and accounts to refresh, etc.

When you create a connection with the widget, it is daily synchronized automatically. If you create a new connection for the current user, you have a parameter indicating whether this connection should be synced automatically or not (defaults = true).

Synchronization

As soon as a job starts, it will undertake a whole series of actions. For each action performed (in success or in error), an event is recorded in a Queue.

To follow the state of synchronization, just listen to the content of the queue and interpret the different events contained in it. Go to the dedicated 'HowTo' queue and events management to have a description of this proccess.

Trigger a synchronization

You can synchronize all the connections of a user or a specific connection.

  • When you synchronize all connections and accounts, the API returns a list of links corresponding to the different connections that will be synchronized.
  • When you synchronize only one connection, the API returns an HTTP 204 status code indicating that the API has taken the request into consideration. You can also specify a synchronization type:
    • Type=ALL allows you to retrieve the information (balances, transactions...) of the financial products linked to the connection.
    • Type=LIST_ACCOUNTS allows you to retrieve the list of financial products linked to this connection. With a synchronization of type LIST_ACCOUNTS, any new account and all the accounts previously deleted will be added automatically. A synchronization of type ALL is started automatically when the LIST_ACCOUNTS synchronization finishes. The final event of the LIST_ACCOUNTS synchronization still contains the account list.

The Synchronization ends when there is an event with event_status: "SYNC_ALL_SUCCESS". You have the synchronization status in the status property of the resource associated with the event. The status description of the connection is described in the API reference]

Example:

# Synchronize one connection
curl -X POST \
{baseUrl}/connections/{connection_id}/synchronize \
-H 'authorization: Bearer {access_token}'

# Synchronization triggered
HTTP/1.1 204 No Content

# Synchronize all connections
curl -X POST \
{baseUrl}/connections/synchronize \
-H 'authorization: Bearer {access_token}'

# Synchronization triggered for each connections
HTTP/1.1 200 No Content

{
"connection_links": [
"/connections/{connection_id_1}",
"/connections/{connection_id_2}",
...
]
}

# If you poll the queue, events stack in the queue
curl -sk {baseUrl}/queues/{queue_id} \
-H 'authorization: Bearer {access_token}'

# Queue contains events
HTTP/1.1 200 OK

# The Synchronization ends when there is an event with event_status=SYNC_ALL_SUCCESS
{
"id": "20",
"event_type": "SYNC_ALL_SUCCESS",
"resource_type": "CONNECTION",
"creation_date": 1528112097,
"resource": {
"id": "{connection_id}",
"provider_id": "200",
"name": "WBX Test Bank",
"channels": [
{
"channel_definition_id": "8701",
"expires": 1528106353
"status": "SUCCESS",
"last_success_date": 1528112084,
"last_end_date": 1528112084
},
{
"channel_definition_id": "8700",
"status": "SUCCESS",
"last_success_date": 1528112084,
"last_end_date": 1528112084
}
],
"status": "SUCCESS",
"creation_date": 0
}
}