Admin Endpoints
Jitsu has a number system for diagnostics and provisioning (aka admin end-points). All those end-points are secured with a configurable token:
server:
admin_token: your_admin_token
destinations:
...
Put admin token to HTTP requests in X-Admin-Token
header
See a list of all API endpoints below
POST/api/v1/destinations/test#
This end-point tests if Jitsu can connect to particular destination
Parameters
Request Payload and Response
Request payload should follow the same structure as Jitsu destination configuration. Example for postgres
{
"type": "postgres",
"datasource": {
"host": "my_postgres_host",
"db": "my-db",
"schema": "myschema",
"port": 5432,
"username": "user",
"password": "pass",
"parameters": {}
}
}
Response will be either HTTP 200 OK, or error with description as JSON
GET/api/v1/cluster#
This api call returns a cluster information as JSON. If synchronization service is configured, this endpoint returns all instances in the cluster, otherwise only server.name from the configuration.
Parameters
Response
Response body contains instance names (from server.name configuration section). Example:
{
"instances": [
{
"name": "instance1.domain.com"
},
{
"name": "instance2.domain.com"
}
]
}
GET/api/v1/fallback?destination_ids=id1,id2#
Get all fallback files per destination(s). Fallback files contains all JSON events that haven't been written to a destination due to error. Each line of this file is a JSON object with original JSON event and error description
Response
{
"files": [
{
"file_name": "host-errors-destination1-2020-11-25T09-57-10.411.log",
"destination_id": "destination1",
"uploaded": false,
// error - replaying error
"error": "Error uploading host-errors-destination1-2020-11-25T09-57-10.411.log wrong format"
}
}
POST/api/v1/replay#
This method replays data from the file. File should be locally located on a same machine as server instance. It is suitable to use this endpoint in case you don't have access to the server file system. In case you have the access, it might be more convenient to use Jitsu CLI.
Request and response
Request example
{
"file_name": "hostname-destination1-2020-11-25T09-57-10.411.log"
}
Response will be either HTTP 200 OK, or error with description as JSON
POST/api/v1/templates/evaluate#
Evaluates input JavaScript functions or GO text/template expression with input object. It is suitable for:
- testing table name template - rules for choosing table name for every income JSON event.
- testing HTTP body payload and HTTP URL - expressions in WebHook destination configuration.
Request
{
"object": {
"app": "jitsu_cloud",
"user": {
"anonymous_id": "anonym_id",
"id": "id"
},
"src": "jitsu",
"event_type": "site_page"
},
"expression": "$.event_type"
}
Response
HTTP 200
{
"result": "site_page",
"format": "javascript"
}
or HTTP 400
{
"message": "Error description",
"format": "go"
}
POST/api/v1/sources/clear_cache#
Clears Jitsu API connector cache (state) for re-sync. More information about re-sync.
Request
{
"source": "google_analytics",
"collection": "acquisition_overview"
}
Response
HTTP 200
{
"status": "ok"
}
or HTTP 400
{
"message": "Error description"
}