Synchronization Scheduling
Jitsu supports automatic collection synchronization as well as manual. For using automatic collection synchronization
there must be configured schedule
property in the collection
section of configuration (see above).
For using manual collection synchronization(HTTP API) there must be admin token configuration.
server:
admin_token: your_admin_token
sources:
source_id:
type: ...
...
POST/api/v1/tasks?source=sourceID&collection=collectionName#
Since there can be only one task per source - collection pair in the task queue, EventNative returns ID of an existing task, or a new one. (HTTP responses will have different HTTP codes - see example below) Authorization admin token might be provided either as query parameter or HTTP header.
Parameters
Response
Task has been created:
HTTP 201 Created
{
"task_id": "$sourceId_$collectionName_$UUID"
}
Task already exists:
HTTP 200 OK
{
"task_id": "$sourceId_$collectionName_$UUID" #id of an existing task
}
Error Response
Source wasn't found:
{
"message": "Error getting source",
"error": "Source [jitsu_firebase] doesn't exist"
}
Authorization Error Response
{
"message": "Admin token does not match"
}
CURL example
curl --location --request POST 'https://<your_server>/api/v1/tasks?source=<your_source_id>&collection=<your_collection_name>&token=<admin_token>'
GET/api/v1/tasks?source=google_analytics&start=2021-05-26T15%3A30%3A41.040Z&end=2022-05-27T23%3A59%3A59.999Z#
Authorization admin token might be provided either as query parameter or HTTP header
Parameters
Response
Sync tasks list
{
"tasks": [
{
"id": "$sourceId_$collectionName_$UUID",
"source": "$sourceId",
"collection": "$collectionName",
"priority": 299998384585588,
"created_at": "2021-03-10T22:13:32.433956Z",
"started_at": "2021-03-10T22:13:32.567439Z",
"finished_at": "2021-03-10T22:13:34.116187Z",
"status": "SUCCESS"
},
{
"id": "$sourceId_$collectionName_$UUID",
"source": "$sourceId",
"collection": "$collectionName",
"priority": 299998384585588,
"created_at": "2021-03-11T00:13:32.433956Z",
"started_at": "2021-03-11T00:13:32.567439Z",
"status": "RUNNING"
}
]
}
Error Response
Source wasn't found:
{
"message": "Error getting source",
"error": "Source [jitsu_firebase_auth_uses] doesn't exist"
}
Authorization Error Response
{
"message": "Admin token does not match"
}
CURL example
curl -X GET 'https://<your_server>/api/v1/tasks?source=<your_source_id>&token=<admin_token>&start=2020-01-01T00:00:00Z&end=2024-12-31T23:59:59Z'
GET/api/v1/tasks/:taskId#
Authorization admin token might be provided either as query parameter or HTTP header
Parameters
Response
Sync task payload
{
"id": "$sourceId_$collectionName_$UUID",
"source": "$sourceId",
"collection": "$collectionName",
"priority": 299998384583699,
"created_at": "2021-03-10T22:45:01.512528Z",
"status": "SCHEDULED"
}
Error Response
Source wasn't found:
{
"message": "Error getting source",
"error": "Source [jitsu_firebase_auth_uses] doesn't exist"
}
Authorization Error Response
{
"message": "Admin token does not match"
}
CURL example
curl -X GET 'https://<your_server>/api/v1/tasks/<your_task_id>?token=<admin_token>'
GET/api/v1/tasks/:taskId/logs#
Authorization admin token might be provided either as query parameter or HTTP header
Parameters
Response
Sync task log messages
{
"logs": [
{
"time": "2021-03-10T22:45:02.578999Z",
"message": "[$sourceId_$collectionName_$UUID] Running task...",
"level": "info"
},
{
"time": "2021-03-10T22:45:02.588929Z",
"message": "[$sourceId_$collectionName_$UUID] Total intervals: [1]",
"level": "info"
},
{
"time": "2021-03-10T22:45:03.870479Z",
"message": "[$sourceId_$collectionName_$UUID] FINISHED SUCCESSFULLY in [1.28] seconds (~ 0.02 minutes)",
"level": "info"
}
]
}
Error Response
Source wasn't found:
{
"message": "Error getting source",
"error": "Source [jitsu_firebase_auth_uses] doesn't exist"
}
Authorization Error Response
{
"message": "Admin token does not match"
}
CURL example
curl -X GET 'https://<your_server>/api/v1/tasks/<your_task_id>/logs?token=<admin_token>'