Skip to main content
The CData Sync REST API V2 supports the following job management actions: The following sections describe each of these actions.

List All Jobs in a Specified Workspace

The following command returns a list of all jobs within a workspace in CData Sync:
GET http://<SyncHost>/api.rsc/v2/workspaces/{workspace_id}/jobs
Path Parameter
NameDescription
workspace_id (required)Identifies the workspace from which to retrieve the list of jobs.

Create a Job in a Specified Workspace

The following command creates a new job in a specified workspace:
POST http://<SyncHost>/api.rsc/v2/workspaces/{workspace_id}/jobs
Path Parameter
NameDescription
workspace_id (required)Identifies the workspace in which to create the job.
Body Parameters
NameDescription
NameSpecifies the name of the job.
TypeSpecifies the type of job. Values are Standard, SyncAll, LoadFolder, ChangeDataCapture, and ReverseETL.
Source-ConnectionSpecifies the identifier (Id) and name of the source connection.
Destination-ConnectionSpecifies the identifier (Id) and name of the destination connection.
ScheduleSpecifies whether to execute a job according to a specific scheduler. Set the Enabled subparameter to True to execute the job per a specific scheduler.
CronSpecifies the scheduler cron string.
Send_EmailSpecifies whether to send email alerts after job completion. Set this parameter to True to send the email alerts.
Email_ToSpecifies the email address to which alerts should be sent.
EmailErrorOnlySpecifies to send an email only when an error occurs.
Enable_Parallel_ProcessingSpecifies to enable parallel processing when this parameter is set to True.
Worker_PoolSpecifies the number of worker pools.
VerbositySpecifies the log verbosity level of the job.
Destination_SchemaSpecifies the destination schema string.
Table_Name_PrefixSpecifies a prefix for all tables that are replicated.
Use_GMT_DateTimeSpecifies whether to synchronize times in Greenwich Mean Time (rather than local time). Set this parameter to True to synchronize times in the GMT time zone.
History_ModeSpecies whether to enable history mode.
Truncate_Table_DataSpecifies whether to delete all rows before each update. Set this parameter to True to delete all rows before an update.
Drop_TableSpecifies whether to drop a table before each update. Set this parameter to True to drop a table before an update.
Auto_Truncate_StringsSpecifies whether to truncate strings automatically that are too large for the column size. Set this parameter to True to truncate strings automatically if they are too large for the column.
Continue_On_ErrorSpecifies whether a job should continue to the next query when it encounters an error. Set this parameter to True for the job to continue to the next table when previous table generates an error.
Deletion_BehaviorSpecifies the type of deletion (for example, HardDelete).
Alter_SchemaSpecifies whether to add columns and alter data types when the source table metadata and the destination table metadata do not match. Set this parameter to True to add columns and alter data types if a mismatch does occur.
Replicate_IntervalPaired with ReplicateIntervalUnit, this parameter controls the time frames in which to split the data during replication.
Replicate_Interval_UnitPaired with ReplicateInterval, this parameter controls the time frames in which to split the data during replication. Values are minutes, hours, days, weeks, months, years.
Replicate_Start_DateSets the minimum date (in the form yyyy-MM-dd) from which to begin replicating data.
Batch_SizeSets the size of the batch.
Pre_Job_EventSpecifies the code of pre-job event.
Post_Job_EventSpecifies the code of post-job event.
CDC_Engine_SettingsSpecifies settings like Name and Schema for the CDC engine.
LabelsSpecifies job labels.
Pipeline IdSpecifies the Id of the pipeline in which the job is used.
QueriesSpecifies the queries to use in the job.
Example Request
{
  "name": "salesforce-standard-job",
  "type": "Standard",
  "source_connection": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "salesforce-production"
  },
  "destination_connection": {
    "id": "550e8400-e29b-41d4-a716-446655440220",
    "name": "snowflake-production"
  },
  "schedule": {
    "enabled": false,
    "cron": ""
  },
  "replicate_options": {
    "replicate_start_date": null,
    "replicate_interval": 180,
    "replicate_interval_unit": "days",
    "alter_schema": true,
    "drop_table": false,
    "truncate_table_data": false,
    "table_name_prefix": "",
    "table_name_suffix": null,
    "continue_on_error": true,
    "batch_size": null,
    "deletion_behavior": "HardDelete",
    "insert_mode": null,
    "auto_truncate_Strings": true,
    "use_gmt_datetime": false,
    "history_mode": false
  },
  "alerts": {
    "send_email": true,
    "email_to": "user@domain.com",
    "email_error_only": true
  },
  "settings": {
    "enable_parallel_processing": false,
    "worker_pool": 2,
    "verbosity": 2,
    "destination_schema": "",
    "automatic_job_retry": false
  },
  "pre_job_event": {
    "script": ""
  },
  "post_job_event": {
    "script": ""
  },
  "cdc_engine_settings": {
    "publication_name": "cdatasync_pub",
    "schema":"public"  
  },
  "labels": [],
  "pipeline_id": "12345",
  "queries": [
    "REPLICATE [connections]",
    "REPLICATE [users]"
  ]
}

Update a Job

The following command updates an existing job.
PUT http://<SyncHost>/api.rsc/v2/jobs{job_id}
Note: You cannot update a job that is running. Query Parameter
NameDescription
job_id (required)Identifies the job that you want to update.
Body Parameters
NameDescription
NameSpecifies the name of your job.
ScheduleSpecifies whether to execute a job according to a specific scheduler. Set the Enabled subparameter to True to execute the job per a specific scheduler.
CronSpecifies the scheduler cron string.
Send_EmailSpecifies whether to send email alerts after job completion. Set this parameter to True to send the email alerts.
Email_ToSpecifies the email address to which alerts should be sent.
Email_SubjectSpecifies the email subject for alerts.
Email_Error_OnlySpecifies to send an email only when an error occurs.
VerbositySpecifies the log verbosity level of the job. Values are 1, 2, 3, and 5.
Table_Name_PrefixSpecifies a prefix for all tables that are replicated.
Use_GMT_DateTimeSpecifies whether to synchronize times in Greenwich Mean Time (rather than local time). Set this parameter to True to synchronize times in the GMT time zone.
Truncate_Table_DataSpecifies whether to delete all rows before each update. Set this parameter to True to delete all rows before an update.
Drop_TableSpecifies whether to drop a table before each update. Set this parameter to True to drop a table before an update.
Auto_Truncate_StringsSpecifies whether to truncate strings automatically that are too large for the column size. Set this parameter to True to truncate strings automatically if they are too large for the column.
Continue_On_ErrorSpecifies whether a job should continue to the next query when it encounters an error. Set this parameter to True for the job to continue to the next table when previous table generates an error.
Alter_SchemaSpecifies whether to add columns and alter data types when the source table metadata and the destination table metadata do not match. Set this parameter to True to add columns and alter data types if a mismatch does occur.
Replicate_IntervalPaired with ReplicateIntervalUnit, this parameter controls the time frames in which to split the data during replication.
Replicate_Interval_UnitPaired with ReplicateInterval, this parameter controls the time frames in which to split the data during replication. Values are minutes, hours, days, weeks, months, years.
Replicate_Start_DateSets the minimum date (in the form yyyy-MM-dd) from which to begin replicating data.
Batch_SizeSets the size of the batch.
Pre_Job_EventSpecifies the code of pre-job event.
Post_Job_EventSpecifies the code of post-job event.
LabelsSpecifies job labels.
Pipeline IdSpecifies the Id of the pipeline in which the job is used.
Example Request
{
  "name": "reverseETLJob",
  "schedule": {
    "enabled": false,
    "cron": ""
  }

Delete a Job

The following command removes a job from the Sync application:
DELETE http://<SyncHost>/api.rsc/v2/jobs{job_id}
Note: You cannot delete a job that is running. Path Parameter
NameDescription
job_id (required)Identifies the job that you want to delete.

Execute a Job

The following command executes a job:
POST http://<SyncHost>/api.rsc/v2/jobs/{job_id}/execute
Path Parameter
NameDescription
job_id (required)Identifies the job that you want to execute.
Body Parameters
NameDescription
TasksSpecifies a list of job task Ids to execute.
Example Request
{
  tasks:[
    "870237973789151200",
    "870875808946851841",
    "870875808946851842"    
  ]
}

Cancel a Running Job

The following command cancels a running job:
POST http://<SyncHost>/api.rsc/v2/jobs/{job_id}/cancel
Path Parameter
NameDescription
job_id (required)Identifies the job that you want to cancel.

List the Job History

The following command retrieves all histories for a job:
GET http://<SyncHost>/api.rsc/v2/jobs/{job_id}/history
Path Parameter
NameDescription
job_id (required)Identifies the job for which you want to retrieve the history.

Retrieve a Specified Job History

The following command retrieves a specified history for a job:
GET http://<SyncHost>/api.rsc/v2/jobs/{job_id}/history/{history_id}
Path Parameters
NameDescription
job_id (required)Identifies the job for which you want to retrieve the history.
history_IdIdentifies the specific history instance to retrieve.

Retrieve the Job Status

The following command retrieves the status for a job run:
GET http://<SyncHost>/api.rsc/v2/jobs/{job_id}/status
Path Parameter
NameDescription
job_id (required)Identifies the job for which you want to retrieve the status.

List All Job Tasks

The following command retrieves a list of tasks that are associated with a job or transformation:
GET http://<SyncHost>/api.rsc/v2/jobs/{job_id}/tasks
Path Parameter
NameDescription
job_id (required)Identifies the job for which you want to list all tasks.

Retrieve a Task

The following command retrieves a specific task from within a job:
GET http://<SyncHost>/api.rsc/v2/jobs/{job_id}/tasks/{task_id}
Path Parameters
NameDescription
job_id (required)Identifies the job for which you want to retrieve the status.
task_id (required)Specifies the Id of the task that you want to retrieve.

Add a Task

The following command adds a task to a job:
POST http://<SyncHost>/api.rsc/v2/jobs/{job_id}/tasks
Path Parameter
NameDescription
job_id (required)Identifies the job in which you want to add a task.
Body Parameters
NameDescription
QuerySpecifies the SQL statement that defines the operation performed by the task.
Is_ActiveSpecifies whether the task is enabled and will be executed when the job runs.
Example Request
{
  "query": "REPLICATE [Accounts] SELECT * FROM [Accounts]",
  "is_active": true
}

Update a Task

The following command updates a job task:
PUT http://<SyncHost>/api.rsc/v2/jobs/{job_id}/tasks/{task_id}
Path Parameters
NameDescription
job_id (required)Identifies the job that contains the task that you want to update.
task_id (required)Specifies the Id of the task that you want to update.
Body Parameters
NameDescription
QuerySpecifies the SQL statement that defines the operation performed by the task.
Is_ActiveSpecifies whether the task is enabled and will be executed when the job runs.
Example Request
{
  "query": "REPLICATE [Accounts] SELECT * FROM [Accounts]",
  "is_active": true,
  "index": 1
}

Delete a Task

The following command deletes a job task:
DELETE http://<SyncHost>/api.rsc/v2/jobs/{job_id}/tasks/{task_id}
Note: You cannot delete a task that is running. Path Parameters
NameDescription
job_id (required)Identifies the job that contains the task that you want to delete.
task_id (required)Specifies the Id of the task that you want to delete.

Move a Task

The following command moves the position of a task within a job:
POST http://<SyncHost>/api.rsc/v2/jobs/{job_id}/tasks/{task_id}/move
Path Parameters
NameDescription
job_id (required)Identifies the job that contains the task that you want to move.
task_id (required)Specifies the Id of the task that you want to move.
Body Parameters
NameDescription
From_IndexSpecifies the original index number for the task.
To_IndexSpecifies the index number to which you are moving the task.
Example Request
{
  "from_index": 0,
  "to_index": 1
}

Retrieve the Last Run of All Tasks

The following command retrieves the last run of all tasks in a job:
GET http://<SyncHost>/api.rsc/v2/jobs/{job_id}/tasks/last-run
Path Parameter
NameDescription
job_id (required)Identifies the job for which you want to retrieve the status of the last run of all tasks.

Retrieve the Task History

The following command retrieves the history for a specified task:
GET http://<SyncHost>/api.rsc/v2/jobs/{job_id}/tasks/{task_id}/history
Path Parameters
NameDescription
job_id (required)Identifies the job that contains the task history that you want to retrieve.
task_id (required)Specifies the Id of the task for which you want to retrieve the history.