Like Jitsu? Give us a star on ⭐ GitHub!

πŸ“œ Configuration

Configuration UI

πŸ‘©β€πŸ”¬ Extending Jitsu

Overview
Destination Extensions
Source Extensions
API Specs

Jitsu Internals

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

source
required
Query String Parameter
string
Source ID from 'sources' configuration section
collection
required
Query String Parameter
string
Collection name from 'sources' configuration section
X-Admin-Token
required
header
string
Admin token
token
required
Query String Parameter
string
Admin token

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

source
required
Query String Parameter
string
Source ID from 'sources' configuration section
collection
optional
Query String Parameter
string
Collection name from 'sources' configuration section. Default value: all collections
start
required
Query String Parameter
string
Start of time interval in ISO 8601 ('2006-01-02T15:04:05.000000Z') format
end
required
Query String Parameter
string
End of time interval in ISO 8601 ('2006-01-02T15:04:05.000000Z') format
limit
optional
Query String Parameter
int
Limit of returned tasks per collection. Default value: 0 - no limit
status
optional
Query String Parameter
string
Task status filter. Available values: [scheduled, running, failed, success]. Default value: all statuses
X-Admin-Token
required
header
string
Admin token
token
required
Query String Parameter
string
Admin token

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

taskId
required
Path parameter
string
Task ID
X-Admin-Token
required
header
string
Admin token
token
required
Query String Parameter
string
Admin token

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

taskId
required
Path parameter
string
Task ID
start
optional
Query String Parameter
string
Start of time interval in ISO 8601 ('2006-01-02T15:04:05.000000Z') format. Default value: Unix start epoch (1970-01-01..)
end
optional
Query String Parameter
string
End of time interval in ISO 8601 ('2006-01-02T15:04:05.000000Z') format. Default value: time.Now() UTC
X-Admin-Token
required
header
string
Admin token
token
required
Query String Parameter
string
Admin token

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>'