Skip to content
POST /sync-job

Request Body

args_schemaobject
required·

JSON schema defining the structure of the arguments that can be passed to the sync job. Same shape as JsonSchemaObject (top-level { type: "object", properties }).

Example: { "type": "object", "properties": { "project_slug": { "type": "string", "description": "The project slug of the project on CircleCI. Its in the format vcs_provider/org_name/repo_name.", "required": true } } }
$refstring
additionalPropertiesboolean
default
descriptionstring
propertiesRecord<string, any>

Map of property name → JsonSchemaObjectProperties.

requiredboolean
typestring
Possible values:
object
args_validationstring

An optional JSONata expression evaluated against the run's args when a sync job run is created. Return an object with a message field to reject the args with a 400.

default_runtime_versioninteger

The runtime version that sync job runs use by default. Defaults to 3.

Example: 4
Possible values:
1234
delay_between_requests_msinteger

An optional delay, in milliseconds, between requests made by the sync job's runs on runtime version 4.

integration_namestring

The name of the integration that this sync job interacts with.

Example: zendesk
labelstring

A human-readable name for the sync job. Defaults to Untitled.

Example: Zendesk tickets
mutex_keystring

An optional key, with {{args.*}} placeholders, that stops a new run from starting while a run with the same resolved key is still active. Applies on runtime version 4.

resourcesobject[]

The resources to sync as part of the sync job.

depends_onstring

The resource that this resource depends on (parent resource). This is optional and can be used to sync a resource only after another resource has been synced. Each object synced for the parent resource is available as the resources object in placeholders for the child resource, e.g. {{resources.crm.contacts.id}} if depends on is crm/contacts resource.

Example: crm/contacts
idstring

The ID of the resource to sync. This is optional and can be used to sync a single resource. It also supports placeholders.

Example: Static value like `4a4de828-f4db-4c9e-adfd-434e0864c3c7` or placeholder like `{{args.user_id}}`.
loop_onstring

When a particular placeholder argument is an array and you want to repeat the request for each element in that array, you can set this parameter. For example, if you accept an argument called user_ids which is an array of strings, and you want to fetch each user's details, you can set this parameter to args.user_ids and the request will be repeated for each element in the user_ids array.

Example: args.user_ids
methodstring

The method to call on the resource.

Example: list
namestring

The name of the node. Required on runtime version 4, where depends_on and destinations refer to nodes by name. Keep names unique within a sync job.

Example: tickets
persistboolean

Whether to persist the resource in the database or not in case of a Daemon sync job run or send as a payload in case of RapidBridge sync job run. The Proxy API resources are by default NOT persisted and this parameter can be set to true to persist them. Unified API resources are always persisted.

queryRecord<string, any>

The query parameters to pass to the resource method. It supports placeholders for values.

Example: { "page": 1, "per_page": 100, "user_id": "{{args.user_id}}" }
resourcestring

The name of the resource to sync. Required for request nodes and on runtime versions 1 to 3. For Unified APIs, it should be in the format unified_api_name/resource_name. For Proxy API, it can just be resource_name.

Example: For fetching Contacts from CRM Unified API, `crm/contacts`. For fetching Contacts from a Proxy API, `contacts`.
run_ifstring

A JSONata expression. On runtime version 4 the node runs only when it evaluates to a truthy value.

typestring

The node type. Required on runtime version 4. Each type reads its own fields; resource, method, id, query and loop_on apply to request nodes.

Example: request
Possible values:
requesttransformspooladd_contextdestinationeventget_stateupdate_statedelete_state
state_keystring

An optional key, with {{args.*}} placeholders, that names the namespace the sync job's get_state, update_state and delete_state nodes read and write.

Response Body

args_schemaobject
required·

JSON schema defining the structure of the arguments that can be passed to the sync job. Same shape as JsonSchemaObject (top-level { type: "object", properties }).

Example: { "type": "object", "properties": { "project_slug": { "type": "string", "description": "The project slug of the project on CircleCI. Its in the format vcs_provider/org_name/repo_name.", "required": true } } }
$refstring
additionalPropertiesboolean
default
descriptionstring
propertiesRecord<string, any>

Map of property name → JsonSchemaObjectProperties.

requiredboolean
typestring
Possible values:
object
args_validationstring

An optional JSONata expression evaluated against the run's args when a sync job run is created. Return an object with a message field to reject the args with a 400.

created_atstring · date-time

The date and time when the sync job was created.

Example: 2021-08-10T10:00:00.000Z
default_runtime_versioninteger

The runtime version that sync job runs use by default.

Example: 4
Possible values:
1234
delay_between_requests_msinteger

An optional delay, in milliseconds, between requests made by the sync job's runs on runtime version 4.

environment_idstring · uuid

The ID of the environment that this sync job belongs to.

Example: 05daecaf-4365-42e8-8370-8127de5dd717
idstring · uuid

The ID of the sync job.

Example: 4a4de828-f4db-4c9e-adfd-434e0864c3c7
integration_namestring

The name of the integration that this sync job interacts with.

Example: zendesk
labelstring

A human-readable name for the sync job.

Example: Zendesk tickets
mutex_keystring

An optional key, with {{args.*}} placeholders, that stops a new run from starting while a run with the same resolved key is still active. Applies on runtime version 4.

Example: {{args.integrated_account_id}}
resourcesobject[]

The resources to sync as part of the sync job.

depends_onstring

The resource that this resource depends on (parent resource). This is optional and can be used to sync a resource only after another resource has been synced. Each object synced for the parent resource is available as the resources object in placeholders for the child resource, e.g. {{resources.crm.contacts.id}} if depends on is crm/contacts resource.

Example: crm/contacts
idstring

The ID of the resource to sync. This is optional and can be used to sync a single resource. It also supports placeholders.

Example: Static value like `4a4de828-f4db-4c9e-adfd-434e0864c3c7` or placeholder like `{{args.user_id}}`.
loop_onstring

When a particular placeholder argument is an array and you want to repeat the request for each element in that array, you can set this parameter. For example, if you accept an argument called user_ids which is an array of strings, and you want to fetch each user's details, you can set this parameter to args.user_ids and the request will be repeated for each element in the user_ids array.

Example: args.user_ids
methodstring

The method to call on the resource.

Example: list
namestring

The name of the node. Required on runtime version 4, where depends_on and destinations refer to nodes by name. Keep names unique within a sync job.

Example: tickets
persistboolean

Whether to persist the resource in the database or not in case of a Daemon sync job run or send as a payload in case of RapidBridge sync job run. The Proxy API resources are by default NOT persisted and this parameter can be set to true to persist them. Unified API resources are always persisted.

queryRecord<string, any>

The query parameters to pass to the resource method. It supports placeholders for values.

Example: { "page": 1, "per_page": 100, "user_id": "{{args.user_id}}" }
resourcestring

The name of the resource to sync. Required for request nodes and on runtime versions 1 to 3. For Unified APIs, it should be in the format unified_api_name/resource_name. For Proxy API, it can just be resource_name.

Example: For fetching Contacts from CRM Unified API, `crm/contacts`. For fetching Contacts from a Proxy API, `contacts`.
run_ifstring

A JSONata expression. On runtime version 4 the node runs only when it evaluates to a truthy value.

typestring

The node type. Required on runtime version 4. Each type reads its own fields; resource, method, id, query and loop_on apply to request nodes.

Example: request
Possible values:
requesttransformspooladd_contextdestinationeventget_stateupdate_statedelete_state
state_keystring

An optional key, with {{args.*}} placeholders, that names the namespace the sync job's get_state, update_state and delete_state nodes read and write. Required for a sync job that uses those nodes.

Example: zendesk-tickets-{{args.integrated_account_id}}
updated_atstring · date-time

The date and time when the sync job was last updated.

Example: 2021-08-10T10:00:00.000Z
truto sync-jobs create \
  -b '{
  "integration_name": "zendesk",
  "label": "Zendesk tickets",
  "default_runtime_version": 4,
  "args_validation": "your_args_validation",
  "mutex_key": "your_mutex_key",
  "state_key": "your_state_key",
  "delay_between_requests_ms": 0,
  "args_schema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"project_slug\": {\n      \"type\": \"string\",\n      \"description\": \"The project slug of the project on CircleCI. Its in the format vcs_provider/org_name/repo_name.\",\n      \"required\": true\n    }\n  }\n}\n",
  "resources": []
}' \
  -o json
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const body = {
  "integration_name": "zendesk",
  "label": "Zendesk tickets",
  "default_runtime_version": 4,
  "args_validation": "your_args_validation",
  "mutex_key": "your_mutex_key",
  "state_key": "your_state_key",
  "delay_between_requests_ms": 0,
  "args_schema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"project_slug\": {\n      \"type\": \"string\",\n      \"description\": \"The project slug of the project on CircleCI. Its in the format vcs_provider/org_name/repo_name.\",\n      \"required\": true\n    }\n  }\n}\n",
  "resources": []
};

const result = await truto.syncJob.create(body);

console.log(result);
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    body = {
        "integration_name": "zendesk",
        "label": "Zendesk tickets",
        "default_runtime_version": 4,
        "args_validation": "your_args_validation",
        "mutex_key": "your_mutex_key",
        "state_key": "your_state_key",
        "delay_between_requests_ms": 0,
        "args_schema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"project_slug\": {\n      \"type\": \"string\",\n      \"description\": \"The project slug of the project on CircleCI. Its in the format vcs_provider/org_name/repo_name.\",\n      \"required\": True\n    }\n  }\n}\n",
        "resources": []
    }

    result = await truto_api.sync_jobs.create(body)
    print(result)

asyncio.run(main())
curl -X POST 'https://api.truto.one/sync-job' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "integration_name": "zendesk",
  "label": "Zendesk tickets",
  "default_runtime_version": 4,
  "args_validation": "your_args_validation",
  "mutex_key": "your_mutex_key",
  "state_key": "your_state_key",
  "delay_between_requests_ms": 0,
  "args_schema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"project_slug\": {\n      \"type\": \"string\",\n      \"description\": \"The project slug of the project on CircleCI. Its in the format vcs_provider/org_name/repo_name.\",\n      \"required\": true\n    }\n  }\n}\n",
  "resources": []
}'
const body = {
  "integration_name": "zendesk",
  "label": "Zendesk tickets",
  "default_runtime_version": 4,
  "args_validation": "your_args_validation",
  "mutex_key": "your_mutex_key",
  "state_key": "your_state_key",
  "delay_between_requests_ms": 0,
  "args_schema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"project_slug\": {\n      \"type\": \"string\",\n      \"description\": \"The project slug of the project on CircleCI. Its in the format vcs_provider/org_name/repo_name.\",\n      \"required\": true\n    }\n  }\n}\n",
  "resources": []
};

const response = await fetch('https://api.truto.one/sync-job', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
import requests

url = "https://api.truto.one/sync-job"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "integration_name": "zendesk",
    "label": "Zendesk tickets",
    "default_runtime_version": 4,
    "args_validation": "your_args_validation",
    "mutex_key": "your_mutex_key",
    "state_key": "your_state_key",
    "delay_between_requests_ms": 0,
    "args_schema": "{\n  \"type\": \"object\",\n  \"properties\": {\n    \"project_slug\": {\n      \"type\": \"string\",\n      \"description\": \"The project slug of the project on CircleCI. Its in the format vcs_provider/org_name/repo_name.\",\n      \"required\": True\n    }\n  }\n}\n",
    "resources": []
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())