This is a Jitsu.Classic documentation. For the lastest version, please visit docs.jitsu.com. Read about differences here.

πŸ“œ Configuration

Configuration UI

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

Overview
Destination Extensions
Source Extensions
API Specs

Jitsu Internals

Jitsu Server

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

X-Admin-Token
required
header
string
Authorization token (see below)

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

X-Admin-Token
required
header
string
Authorization token (see above)

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

X-Admin-Token
required
header
string
Authorization token (see above)
destination_id
required
Query String Parameter
string
comma-separated array of destination ids strings

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.

X-Admin-Token
required
header
string
Authorization token (see above)
file_format
optional
Body Parameter (JSON)
string
File format
destination_id
optional
Body Parameter (JSON)
string
Destination to load data. By default, it is taken from fallback file name.
file_name
required
Body Parameter (JSON)
string
name of a fallback file to replay or global path to a custom file with json data
skip_malformed
optional
Body Parameter (JSON)
boolean
Set true and fallback file won't be interrupted if any fallback event is malformed. Malformed events will be written into application logs with error message. Default value is false means that whole fallback file won't be processed if it contains any malformed event.

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:

X-Admin-Token
required
header
string
Authorization token (see above)
expression
required
Body Parameter (JSON)
string
GO text/template or JavaScript expression
object
required
Body Parameter (JSON)
JSON object
Event JSON object for evaluating expression
reformat
optional
Body Parameter (JSON)
boolean
If true - result will be reformatted like in table name evaluating (special chars will be replaced)

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.

X-Admin-Token
required
header
string
Authorization token (see above)
source
required
Body Parameter (JSON)
string
ID of source to clear cache (from configuration)
collection
optional
Body Parameter (JSON)
JSON object
Name of collection to clear cache. If empty - all collection's caches will be cleared

Request

{
  "source": "google_analytics",
  "collection": "acquisition_overview"
}

Response

HTTP 200

{
  "status": "ok"
}

or HTTP 400

{
  "message": "Error description"
}