Skip to main content

Documentation Portal

Define a Historical Sync

This endpoint can be used to run one-time synchronization of context items at a specified time interval.

Method: POST
Path: /context-sql-sync/sync
Authorization header: Bearer [access_token]
Body
{
  "datasourceId": "1",
  "queryId": "2",
  "externalIdPrefix": "prefix",
  "startDate": "2018-10-16 12:29:01",
  "endDate": "2018-10-18 20:29:01",
  "chunkSize":1440
}

Parameter

Description

datasourceId

The id of the datasource against which to run the sync.

queryId

The id of the query to be used for the sync.

externalIdPrefix

The prefix that will be prepended to the id obtained from the database in order to produce the external id of the context item. This prefix allows supporting the same external IDs for different data sources.

startDate

The start of the sync interval. This is optional and can be omitted if the respective SQL query does not have parameters.

endDate

The end of the sync interval. This is optional and can be omitted if the respective SQL query does not have parameters.

chunkSize

The sync interval (endDate - startDate) will be split to subintervals with length specified by this value (expressed in minutes). This value is optional and defaults to null to indicate that the entire interval will be synced at one go. The value is also ignored if startDate and endDate are not specified.

The startDate and endDate can be omitted. In this case the associated query will be run only once without parameters.

If the startDate and endDate are specified, the resulting interval is split into small subintervals based on chunkSize. Then the SQL query is executed continuously for each of the subintervals and the start and end of the subintervals are passed to the query as parameters.

The historical sync provides means to perform a “dry” run, where the data is fetched from the database and returned to the customer, but no actual context items are created. To use the dry run:

Path: /context-sql-sync/sync/test