Create sync job run
/sync-job-run
Request Body
The arguments passed to the sync job run.
{
"project_slug": "vcs_provider/org_name/repo_name"
}
The name of the daemon group that this sync job run should be assigned to. Used while creating a sync job run. Truto find a daemon in the group that is available to run the sync job. On runtime versions 1 to 3, specify exactly one of daemon_group_key (Daemon), webhook_id (RapidBridge), datastore_id or super_query while creating a Sync Job Run.
defaultThe ID of a datastore to send the run's records to. On runtime versions 1 to 3, specify exactly one of daemon_group_key (Daemon), webhook_id (RapidBridge), datastore_id or super_query while creating a Sync Job Run.
Specify how to handle errors while running the sync job. fail_fast - stop the sync job run as soon as an error is encountered, ignore - continue running the sync job run even if an error is encountered. In case of ignore, you'll receive sync_job_run:record_error events for each error encountered. In case of batch, you'll receive sync_job_run:record_error events with multiple errors batched into the errors array, this is only supported when the version used for Sync Job Run is 2. By default, ignore is used.
ignorefail_fastignorebatch
Send only these sync_job_run:* and record:* events for the run. When omitted, every event is sent.
["sync_job_run:completed","sync_job_run:failed"]allintegrated_account:createdintegrated_account:updatedintegrated_account:deletedintegrated_account:activeintegrated_account:post_connect_form_submittedintegrated_account:post_install_errorintegrated_account:validation_errorintegrated_account:authentication_errorintegrated_account:forbidden_errorintegrated_account:reactivatedlink_token:connection_errorenvironment_integration:createdenvironment_integration:updatedenvironment_integration:deletedenvironment_unified_model:createdenvironment_unified_model:updatedenvironment_unified_model:deletedapi_token:createdapi_token:updatedapi_token:deletedsync_job_run:createdsync_job_run:updatedsync_job_run:startedsync_job_run:completedsync_job_run:failedsync_job_run:deletedsync_job_run:recordsync_job_run:record_errorsync_job_run:rate_limitedrecord:createdrecord:updatedrecord:deletedrecord:metasync_job_cron_trigger:failedbatch_job:dry_run_completedbatch_job:completedbatch_job:dry_run_failedbatch_job:failed+ 27 more
On runtime versions 1 to 3, a new run is refused while a run of the same sync job, integrated account and args is still active. Set to true to start it anyway. By default, false is used.
falseIf your Sync Job uses previous_run_date placeholder for incremental sync, you can choose to ignore the previous run and run a full sync instead by setting this parameter to true. By default, false is used.
falseThe ID of the integrated account that this sync job run belongs to. Ignored on runtime version 4, where the account is passed in args.
94801e49-a652-42f9-af14-dd203d7897daStore the run's records in SuperQuery in this region. On runtime versions 1 to 3, specify exactly one of daemon_group_key (Daemon), webhook_id (RapidBridge), datastore_id or super_query while creating a Sync Job Run.
apacwnam
The ID of the sync job to run.
1ba1f401-7183-47c5-9e39-e8e257e3c795The runtime version to run on. Defaults to the sync job's default_runtime_version. A version 2 sync job can run on version 2 or 3; every other sync job runs only on its own version.
41234
The ID of the webhook where the sync job records need to be sent. On runtime versions 1 to 3, specify exactly one of daemon_group_key (Daemon), webhook_id (RapidBridge), datastore_id or super_query while creating a Sync Job Run.
4a4de828-f4db-4c9e-adfd-434e0864c3c7Response Body
The arguments passed to the sync job run.
{
"project_slug": "vcs_provider/org_name/repo_name"
}
The date and time when the sync job run was created.
2021-08-10T10:00:00.000ZThe name of the daemon group that this sync job run should be assigned to. Used while creating a sync job run. Truto find a daemon in the group that is available to run the sync job. On runtime versions 1 to 3, specify exactly one of daemon_group_key (Daemon), webhook_id (RapidBridge), datastore_id or super_query while creating a Sync Job Run.
defaultThe daemon_id attribute of a daemon that is running this sync job.
defaultThe ID of the datastore the run's records are sent to, when the run uses a datastore as its destination.
Specifies the error handling strategy used for the sync job run. fail_fast - stop the sync job run as soon as an error is encountered, ignore - continue running the sync job run even if an error is encountered. In case of ignore, you'll receive sync_job_run:record_error events for each error encountered. In case of batch, you'll receive sync_job_run:record_error events with multiple errors batched into the errors array, this is only supported when the version used for Sync Job Run is 2.
ignorefail_fastignorebatch
When set, only these sync_job_run:* and record:* events are sent for the run. When not set, every event is sent.
["sync_job_run:completed","sync_job_run:failed"]allintegrated_account:createdintegrated_account:updatedintegrated_account:deletedintegrated_account:activeintegrated_account:post_connect_form_submittedintegrated_account:post_install_errorintegrated_account:validation_errorintegrated_account:authentication_errorintegrated_account:forbidden_errorintegrated_account:reactivatedlink_token:connection_errorenvironment_integration:createdenvironment_integration:updatedenvironment_integration:deletedenvironment_unified_model:createdenvironment_unified_model:updatedenvironment_unified_model:deletedapi_token:createdapi_token:updatedapi_token:deletedsync_job_run:createdsync_job_run:updatedsync_job_run:startedsync_job_run:completedsync_job_run:failedsync_job_run:deletedsync_job_run:recordsync_job_run:record_errorsync_job_run:rate_limitedrecord:createdrecord:updatedrecord:deletedrecord:metasync_job_cron_trigger:failedbatch_job:dry_run_completedbatch_job:completedbatch_job:dry_run_failedbatch_job:failed+ 27 more
The date and time when the sync job run was finished.
2021-08-10T10:00:00.000ZWhether the run was started even though another run of the same sync job, integrated account and args was still active.
falseThe ID of the sync job run.
4a4de828-f4db-4c9e-adfd-434e0864c3c7Specifies if the sync job run was started ignoring the previous run date.
falseThe ID of the integrated account that this sync job run belongs to.
94801e49-a652-42f9-af14-dd203d7897daThe sync job's mutex_key with the run's args filled in.
The statistics of the resources synced in the sync job run. This will have information around how many records were fetched and persisted by the sync job run -- grouped by the resource and method. The data is updated every 10 seconds while the sync job run is running.
{
"crm/contacts": {
"list": {
"fetched": 100,
"persisted": 100
}
},
"crm/deals": {
"list": {
"fetched": 100,
"persisted": 0
},
"get": {
"fetched": 100,
"persisted": 100
}
}
}
The resources to sync as part of the sync job.
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.
crm/contactsThe ID of the resource to sync. This is optional and can be used to sync a single resource. It also supports placeholders.
Static value like `4a4de828-f4db-4c9e-adfd-434e0864c3c7` or placeholder like `{{args.user_id}}`.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.
args.user_idsThe method to call on the resource.
listThe 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.
ticketsWhether 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.
The query parameters to pass to the resource method. It supports placeholders for values.
{
"page": 1,
"per_page": 100,
"user_id": "{{args.user_id}}"
}
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.
For fetching Contacts from CRM Unified API, `crm/contacts`. For fetching Contacts from a Proxy API, `contacts`.A JSONata expression. On runtime version 4 the node runs only when it evaluates to a truthy value.
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.
requestrequesttransformspooladd_contextdestinationeventget_stateupdate_statedelete_state
The date and time when the sync job run was started.
2021-08-10T10:00:00.000ZThe sync job's state_key with the run's args filled in. Names the namespace the run's state nodes use.
The status of the sync job run. created - waiting to run, running - running, rate_limited - temporarily paused after an upstream rate-limit response and will resume automatically after backoff, completed - completed successfully, failed - failed, stopped - stopped by the user.
runningcreatedrunningrate_limitedcompletedfailedstopped
The SuperQuery region the run's records are stored in, when the run uses SuperQuery as its destination.
apacwnam
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 }).
{
"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
}
}
}
7 properties
Map of property name → JsonSchemaObjectProperties.
object
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.
The date and time when the sync job was created.
2021-08-10T10:00:00.000ZThe runtime version that sync job runs use by default.
41234
An optional delay, in milliseconds, between requests made by the sync job's runs on runtime version 4.
The ID of the environment that this sync job belongs to.
05daecaf-4365-42e8-8370-8127de5dd717The ID of the sync job.
4a4de828-f4db-4c9e-adfd-434e0864c3c7The name of the integration that this sync job interacts with.
zendeskA human-readable name for the sync job.
Zendesk ticketsAn 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.
{{args.integrated_account_id}}The resources to sync as part of the sync job.
10 properties
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.
crm/contactsThe ID of the resource to sync. This is optional and can be used to sync a single resource. It also supports placeholders.
Static value like `4a4de828-f4db-4c9e-adfd-434e0864c3c7` or placeholder like `{{args.user_id}}`.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.
args.user_idsThe method to call on the resource.
listThe 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.
ticketsWhether 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.
The query parameters to pass to the resource method. It supports placeholders for values.
{
"page": 1,
"per_page": 100,
"user_id": "{{args.user_id}}"
}
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.
For fetching Contacts from CRM Unified API, `crm/contacts`. For fetching Contacts from a Proxy API, `contacts`.A JSONata expression. On runtime version 4 the node runs only when it evaluates to a truthy value.
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.
requestrequesttransformspooladd_contextdestinationeventget_stateupdate_statedelete_state
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.
zendesk-tickets-{{args.integrated_account_id}}The date and time when the sync job was last updated.
2021-08-10T10:00:00.000ZThe ID of the sync job that this sync job run belongs to.
4a4de828-f4db-4c9e-adfd-434e0864c3c7The date and time when the sync job run was last updated.
2021-08-10T10:00:00.000ZThe runtime version of the sync job run. Defaults to the sync job's default_runtime_version.
41234
The ID of the webhook where the sync job records need to be sent. On runtime versions 1 to 3, specify exactly one of daemon_group_key (Daemon), webhook_id (RapidBridge), datastore_id or super_query while creating a Sync Job Run.
4a4de828-f4db-4c9e-adfd-434e0864c3c7truto sync-job-runs create \
-b '{
"sync_job_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
"args": "{\n \"project_slug\": \"vcs_provider/org_name/repo_name\"\n}\n",
"integrated_account_id": "94801e49-a652-42f9-af14-dd203d7897da",
"daemon_group_key": "default",
"webhook_id": "4a4de828-f4db-4c9e-adfd-434e0864c3c7",
"error_handling": "ignore",
"ignore_previous_run": false,
"version": 4,
"force": false,
"super_query": "apac",
"datastore_id": "your_datastore_id",
"events_to_send": [
"sync_job_run:completed",
"sync_job_run:failed"
]
}' \
-o jsonimport Truto from '@truto/truto-ts-sdk';
const truto = new Truto({
token: '<your_api_token>',
});
const body = {
"sync_job_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
"args": "{\n \"project_slug\": \"vcs_provider/org_name/repo_name\"\n}\n",
"integrated_account_id": "94801e49-a652-42f9-af14-dd203d7897da",
"daemon_group_key": "default",
"webhook_id": "4a4de828-f4db-4c9e-adfd-434e0864c3c7",
"error_handling": "ignore",
"ignore_previous_run": false,
"version": 4,
"force": false,
"super_query": "apac",
"datastore_id": "your_datastore_id",
"events_to_send": [
"sync_job_run:completed",
"sync_job_run:failed"
]
};
const result = await truto.syncJobRun.create(body);
console.log(result);import asyncio
from truto_python_sdk import TrutoApi
truto_api = TrutoApi(token="<your_api_token>")
async def main():
body = {
"sync_job_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
"args": "{\n \"project_slug\": \"vcs_provider/org_name/repo_name\"\n}\n",
"integrated_account_id": "94801e49-a652-42f9-af14-dd203d7897da",
"daemon_group_key": "default",
"webhook_id": "4a4de828-f4db-4c9e-adfd-434e0864c3c7",
"error_handling": "ignore",
"ignore_previous_run": False,
"version": 4,
"force": False,
"super_query": "apac",
"datastore_id": "your_datastore_id",
"events_to_send": [
"sync_job_run:completed",
"sync_job_run:failed"
]
}
result = await truto_api.sync_job_runs.create(body)
print(result)
asyncio.run(main())curl -X POST 'https://api.truto.one/sync-job-run' \
-H 'Authorization: Bearer <your_api_token>' \
-H 'Content-Type: application/json' \
-d '{
"sync_job_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
"args": "{\n \"project_slug\": \"vcs_provider/org_name/repo_name\"\n}\n",
"integrated_account_id": "94801e49-a652-42f9-af14-dd203d7897da",
"daemon_group_key": "default",
"webhook_id": "4a4de828-f4db-4c9e-adfd-434e0864c3c7",
"error_handling": "ignore",
"ignore_previous_run": false,
"version": 4,
"force": false,
"super_query": "apac",
"datastore_id": "your_datastore_id",
"events_to_send": [
"sync_job_run:completed",
"sync_job_run:failed"
]
}'const body = {
"sync_job_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
"args": "{\n \"project_slug\": \"vcs_provider/org_name/repo_name\"\n}\n",
"integrated_account_id": "94801e49-a652-42f9-af14-dd203d7897da",
"daemon_group_key": "default",
"webhook_id": "4a4de828-f4db-4c9e-adfd-434e0864c3c7",
"error_handling": "ignore",
"ignore_previous_run": false,
"version": 4,
"force": false,
"super_query": "apac",
"datastore_id": "your_datastore_id",
"events_to_send": [
"sync_job_run:completed",
"sync_job_run:failed"
]
};
const response = await fetch('https://api.truto.one/sync-job-run', {
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-run"
headers = {
"Authorization": "Bearer <your_api_token>",
"Content-Type": "application/json",
}
params = {
}
payload = {
"sync_job_id": "1ba1f401-7183-47c5-9e39-e8e257e3c795",
"args": "{\n \"project_slug\": \"vcs_provider/org_name/repo_name\"\n}\n",
"integrated_account_id": "94801e49-a652-42f9-af14-dd203d7897da",
"daemon_group_key": "default",
"webhook_id": "4a4de828-f4db-4c9e-adfd-434e0864c3c7",
"error_handling": "ignore",
"ignore_previous_run": False,
"version": 4,
"force": False,
"super_query": "apac",
"datastore_id": "your_datastore_id",
"events_to_send": [
"sync_job_run:completed",
"sync_job_run:failed"
]
}
response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())