Create sync job cron triggers
/sync-job-cron-trigger
Request Body
The arguments passed to the sync job run.
{
"project_slug": "vcs_provider/org_name/repo_name"
}
The cron expression that defines when the sync job should be run. The timezone used is UTC. Runs must be at least 5 minutes apart. When the trigger is saved, the gap between its next two runs is checked.
0 0 * * *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) or super_query.
defaultThe environment to create the trigger in. Ignored for API tokens, which create it in their own environment.
The error_handling each run starts with. See the sync job run's error_handling.
fail_fastignorebatch
When set, only these sync_job_run:* and record:* events are sent for the runs the trigger starts.
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:reactivatedintegrated_account:stalelink_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+ 28 more
Copied to each run the trigger starts. See the sync job run's individual_request_batch_size.
The ID of the integrated account the runs are for. Required on runtime versions 1 to 3. On runtime version 4 it is ignored (the trigger is stored with the zero UUID) and daemon_group_key, webhook_id and super_query are dropped; the job's own nodes decide where records go.
94801e49-a652-42f9-af14-dd203d7897daSend false to create the trigger inactive. It is saved but not scheduled, so it creates no sync job run until a PATCH sets is_active to true.
trueAny JSON object, copied to each run the trigger starts.
Store the records of the runs the trigger starts in SuperQuery in this region. On runtime versions 1 to 3, specify exactly one of daemon_group_key (Daemon), webhook_id (RapidBridge) or super_query.
apacwnam
The ID of the sync job to run.
1ba1f401-7183-47c5-9e39-e8e257e3c795The 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) or super_query.
4a4de828-f4db-4c9e-adfd-434e0864c3c7Response Body
The arguments passed to the sync job cron trigger.
{
"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 cron expression defining when the sync job should run, in UTC.
0 0 * * *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) or super_query.
defaultThe environment the trigger belongs to.
The error_handling each run starts with. See the sync job run's error_handling.
fail_fastignorebatch
When set, only these sync_job_run:* and record:* events are sent for the runs the trigger starts.
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:reactivatedintegrated_account:stalelink_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+ 28 more
The ID of the sync job cron trigger.
4a4de828-f4db-4c9e-adfd-434e0864c3c7Copied to each run the trigger starts. See the sync job run's individual_request_batch_size.
The ID of the integrated account that this sync job cron trigger should run.
94801e49-a652-42f9-af14-dd203d7897daWhether the trigger is active. An inactive trigger is not scheduled, so it creates no sync job run and sends no webhook until it is made active again. New triggers are active unless created with is_active set to false.
trueAny JSON object, copied to each run the trigger starts.
Store the records of the runs the trigger starts in SuperQuery in this region. On runtime versions 1 to 3, specify exactly one of daemon_group_key (Daemon), webhook_id (RapidBridge) or super_query.
apacwnam
The ID of the sync job that this sync job cron trigger should run.
4a4de828-f4db-4c9e-adfd-434e0864c3c7The date and time when the sync job run was last updated.
2021-08-10T10:00:00.000ZThe 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) or super_query.
4a4de828-f4db-4c9e-adfd-434e0864c3c7truto sync-job-triggers 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",
"super_query": "apac",
"cron_expression": "0 0 * * *",
"error_handling": "fail_fast",
"events_to_send": [],
"meta": {},
"individual_request_batch_size": 0,
"environment_id": "your_environment_id",
"is_active": true
}' \
-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",
"super_query": "apac",
"cron_expression": "0 0 * * *",
"error_handling": "fail_fast",
"events_to_send": [],
"meta": {},
"individual_request_batch_size": 0,
"environment_id": "your_environment_id",
"is_active": true
};
const result = await truto.syncJobCronTrigger.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",
"super_query": "apac",
"cron_expression": "0 0 * * *",
"error_handling": "fail_fast",
"events_to_send": [],
"meta": {},
"individual_request_batch_size": 0,
"environment_id": "your_environment_id",
"is_active": True
}
result = await truto_api.sync_job_cron_triggers.create(body)
print(result)
asyncio.run(main())curl -X POST 'https://api.truto.one/sync-job-cron-trigger' \
-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",
"super_query": "apac",
"cron_expression": "0 0 * * *",
"error_handling": "fail_fast",
"events_to_send": [],
"meta": {},
"individual_request_batch_size": 0,
"environment_id": "your_environment_id",
"is_active": true
}'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",
"super_query": "apac",
"cron_expression": "0 0 * * *",
"error_handling": "fail_fast",
"events_to_send": [],
"meta": {},
"individual_request_batch_size": 0,
"environment_id": "your_environment_id",
"is_active": true
};
const response = await fetch('https://api.truto.one/sync-job-cron-trigger', {
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-cron-trigger"
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",
"super_query": "apac",
"cron_expression": "0 0 * * *",
"error_handling": "fail_fast",
"events_to_send": [],
"meta": {},
"individual_request_batch_size": 0,
"environment_id": "your_environment_id",
"is_active": True
}
response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())