Job Management API

Version 24.1.8910


Job Management API


The REST API supports the following job management actions:

The following sections describe each of these actions.

List All Jobs

The following command returns a list of all jobs within the CData Sync application.

GET http://MyDomain.com:8019/api.rsc/jobs(jobname)

Query Parameter

Name Description
JobName Name of the job to retrieve.

Create a Job

The following command creates a new job to run in the Sync application:

POST http://MyDomain.com:8019/api.rsc/jobs

Body Parameters

Name Description
JobName Specifies the name of the job.
Source Specifies the name of the source connection.
Destination Specifies the name of the destination connection.
Scheduled Specifies whether to execute a job according to a specific scheduler. Set the parameter to True to execute the job per a specific scheduler.
ScheduledCron The scheduler cron string.
NotifyWindowsEvent Specifies whether to write error messages to the Microsoft Window Application Event log. Set this parameter to True to write error messages to that event log.
SendEmailNotification Specifies whether to send email notifications after job completion. Set this parameter to True to send the email notifications.
NotifyEmailTo Specifies the email address to which notifications should be sent.
NotifyEmailSubject Specifies the email subject for notifications.
EmailErrorOnly Specifies to send an email only when an error occurs.
Verbosity Specifies the log verbosity level of the job.
TableNamePrefix Specifies a prefix for all tables that are replicated.
UseGmtDateTime Specifies 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.
TruncateTableData Specifies whether to delete all rows before each update. Set this parameter to True to delete all rows before an update.
DropTable Specifies whether to drop a table before each update. Set this parameter to True to drop a table before an update.
AutoTruncateStrings Specifies 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.
ContinueOnError Specifies 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.
AlterSchema Specifies 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.
ReplicateInterval Paired with ReplicateIntervalUnit, this parameter controls the time frames in which to split the data during replication.
ReplicateIntervalUnit Paired with ReplicateInterval, this parameter controls the time frames in which to split the data during replication. Values are minutes, hours, days, weeks, months, years.
ReplicateStartDate Sets the minimum date (in the form yyyy-MM-dd) from which to begin replicating data.
BatchSize Sets the size of the batch.
CommandTimeout Controls the time-out for destination connections.
SkipDeleted Specifies whether to skip the retrieval of deleted records from the source.
OtherCacheOptions Specifies a comma-separated list of additional options to include.
CacheSchema Assigns a specific schema for the destination database.
PreJob Specifies the code of pre-job event.
PostJob Specifies the code of post-job event.
Query# Specifies an array of SQL statements to include in the job. Specify multiple queries with the syntax Query#1, Query#2, and so on.
Type Specifies the type of job (1 indicates type Standard, 2 indicates Sync All, 3 indicates Load Folder, 7 indicates Change Data Capture, and 10 indicates Reverse ETL).

Example

{ 
  "JobName": "MyNewJob", 
  "Source": "SourceConnection",
  "Destination": "DestinationConnection",
  "Query#1":"REPLICATE [Accounts]",
  "Query#2": "REPLICATE [Invoices]"
}

Modify a Job

The following command modifies an existing job:

PUT http://mydomain.com:8019/api.rsc/jobs(jobname)

Note: You cannot modify a job that is running.

Query Parameter

Name Description
JobName (required) Specifies the name of the job to modify.

Body Parameters

Name Description
Scheduled Specifies whether to execute a job according to a specific scheduler. Set the parameter to True to execute the job per a specific scheduler.
ScheduledCron The scheduler cron string.
NotifyWindowsEvent Specifies whether to write error messages to the Microsoft Window Application Event log. Set this parameter to True to write error messages to that event log.
SendEmailNotification Specifies whether to send email notifications after job completion. Set this parameter to True to send the email notifications.
NotifyEmailTo Specifies the email address to which notifications should be sent.
NotifyEmailSubject Specifies the email subject for notifications.
EmailErrorOnly Specifies to send an email only when an error occurs.
Verbosity Specifies the log verbosity level of the job. Values are 1, 2, 3, and 5.
TableNamePrefix Specifies a prefix for all tables that are replicated.
UseGmtDateTime Specifies 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.
TruncateTableData Specifies whether to delete all rows before each update. Set this parameter to True to delete all rows before an update.
DropTable Specifies whether to drop a table before each update. Set this parameter to True to drop a table before an update.
AutoTruncateStrings Specifies 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.
ContinueOnError Specifies 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.
AlterSchema Specifies 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.
ReplicateInterval Paired with ReplicateIntervalUnit, this parameter controls the time frames in which to split the data during replication.
ReplicateIntervalUnit Paired with ReplicateInterval, this parameter controls the time frames in which to split the data during replication. Values are minutes, hours, days, weeks, months, years.
ReplicateStartDate Sets the minimum date (in the form yyyy-MM-dd) from which to begin replicating data.
BatchSize Sets the size of the batch.
CommandTimeout Controls the time-out for destination connections.
SkipDeleted Specifies whether to skip the retrieval of deleted records from the source.
OtherCacheOptions Specifies a comm- separated list of additional options to include.
CacheSchema Assigns a specific schema for the destination database.
PreJob Specifies the code of pre-job event.
PostJob Specifies the code of post-job event.

Example

{ 
  "Scheduled": "true",
  "ScheduledCron": "0-30/5 * * * *"
}

Delete a Job

The following command removes a job from the Sync application:

DELETE http://MyDomain.com:8019/api.rsc/jobs(jobname)

Note: You cannot delete a job that is running.

Query Parameter

Name Description
JobName Name of the job to delete.

List All Transformations

The following command returns a list of all transformations within the Sync application.

GET http://MyDomain.com:8019/api.rsc/transformations(transformationname)

Query Parameter

Name Description
TransformationName Name of the transformation to retrieve.

Create a Transformation

The following command creates a new job to run in the Sync application:

POST http://MyDomain.com:8019/api.rsc/transformations

Body Parameters

Name Description
TransformationName Specifies the name of the transformation.
Connection Specifies the name of the destination connection.
TransformationTriggerMode Specifies whether to run the transformation on a schedule or after a job. Values for this parameter are None (the default value), Scheduled, and After Job.
TriggerAfterJob Specifies the job after which the transformation will run.
TriggerTasks Specifies a comma-separated list of task Ids.
ScheduledCron Specifies the scheduler cron string.
SendEmailNotification Sends email notifications after transformations are complete. Set this to True to send the email notifications.
NotifyEmailTo Specifies the email address to which notifications are to be sent.
NotifyEmailSubject Specifies the email subject for notifications.
EmailErrorOnly Specifies to send an email only when an error occurs.
Verbosity Specifies the log verbosity level of the transformation.
Query# Specifies an array of SQL statements to include in the transformation. Specify multiple queries with the syntax Query#1, Query#2, and so on.

Example

{ 
  "TransformationName": "MyNewTransformation", 
  "Connection": "DestinationConnection",
  "Query#1":"CREATE OR REPLACE TABLE dbo.Accounts_Deduplicated as (SELECT *, row_number() over (partition by id order by modified desc) as duplicate_rank FROM dbo.Accounts);",
  "Query#2": "DELETE FROM dbo.Accounts_Deduplicated	WHERE duplicate_rank > 1;"
}

Modify a Transformation

The following command modifies an existing transformation:

PUT http://MyDomain.com:8019/api.rsc/transformations(transformationname)

Note: You cannot modify a transformation that is running.

Query Parameter

Name Description
TransformationName (Required) Specifies the name of the transformation to modify.

Body Parameters

Name Description
TransformationTriggerMode Specifies whether to run the transformation on a schedule or after a job. Values for this parameter are None (the default value), Scheduled, and AfterJob.
TriggerAfterJob Specifies the job after which the transformation will run.
TriggerTasks Specifies a comma-separated list of task Ids.
ScheduledCron Specifies the scheduler cron string.
SendEmailNotification Sends email notifications after transformations are complete. Set this to True to send the email notifications.
NotifyEmailTo Specifies the email address to which notifications are to be sent.
NotifyEmailSubject Specifies the email subject for notifications.
EmailErrorOnly Specifies to send an email only when an error occurs.
Verbosity Specifies the log verbosity level of the transformation.

Example

{ 
  "TransformationTriggerMode": "Scheduled",
  "ScheduledCron": "0-30/5 * * * *"
}

Delete a Transformation

The following command removes a transformation from the Sync application: You cannot delete a transformation that is running.

DELETE http://MyDomain.com:8019/api.rsc/transformations(transformationname)

Note: You cannot delete a transformation that is running.

Query Parameter

Name Description
TransformationName (Required) Specifies the name of the transformation that you want to delete.

Execute a Job or a Transformation

This command executes the specified job or transformation:

POST http://MyDomain.com:8019/api.rsc/executeJob

Body Parameters

Name Description
JobName (required) Specifies the name of the job to execute.
WaitForResults Specifies whether to wait until the job ends to return results. The default value is True.
Timeout Specifies how long to wait, in seconds, for the previous job execution to complete.

Example

{
  "JobName": "MyJob",
  "WaitForResults" : true,
  "Timeout": 30
}

Execute Job Queries

The following command executes specific queries within a job.

POST http://MyDomain.com:8019/api.rsc/executeQuery

Note: The queries that you want to execute must be part of the job already.

Body Parameters

Name Description
JobName (required) Specifies the name of the job to execute.
Query# (required) Specifies an array of query statements to execute. Specify multiple queries with the syntax Query#1, Query#2, and so on.
WaitForResults Specifies whether to wait until the job ends to return results. The default value is True.

Example

{
  "JobName": "MyJob",
  "Query#1": "REPLICATE [Accounts]",
  "Query#2": "REPLICATE [Contacts]"
}

Cancel a Running Job

The following command cancels a job that is running:

POST http://MyDomain.com:8019/api.rsc/cancelJob

Body Parameters

Name Description
JobName (required) Specifies the name of the job to cancel.

Example

{
  "JobName": "MyJob"
}

Retrieve the Job Status

The following command retrieves the status of a job:

POST http://MyDomain.com:8019/api.rsc/getJobStatus

Body Parameters

Name Description
JobName Specifies the name of the job for which to retrieve the status. If a job name is specified, the response contains details for each query that is within the job.

Example

{
  "JobName":"MyJob"
}

Retrieve the Job History

The following command retrieves the history of the previous runs for a job:

GET http://MyDomain.com:8019/api.rsc/history

Query Parameter

Name Description
JobName Specifies the name of the job for which to retrieve the history.

Download Job Logs

The following command downloads the base-64-encoded contents of the log file or log files for a job:

POST http://mydomain.com:8019/api.rsc/getLogs

Body Parameters

Name Description
JobName (required) Specifies the name of the job from which to retrieve logs.
Days (required) Specifies how many days of log files to include.

List All Job Tasks

The following command retrieves a list of tasks that are associated with a job or transformation:

GET http://MyDomain.com:8019/api.rsc/tasks(jobname)

Query Parameter

Name Description
JobName (required) Specifies the name of the job.

Add a Task to a Job or a Transformation

The following command adds a task to an existing job or transformation:

POST http://MyDomain.com:8019/api.rsc/tasks

Note: You must include either the Query parameter or the Table parameter.

Body Parameters

Name Description
JobName (required) Specifies the name of the job.
Query Specifies the query to set as the task.
Table Specifies the source table to replicate. Sync creates a REPLICATE query from this input.

Update a Task

The following command updates a task in an existing job or transformation:

PUT http://MyDomain.com:8019/api.rsc/tasks

Body Parameters

Name Description
JobName (required) Specifies the name of the job.
TaskId (required) Specifies the task to update.
Query Specifies the query to set as the task.
Table Specifies the source table to replicate. Sync creates a REPLICATE query from this input.

Delete a Task

The following command deletes a task from an existing job or transformation:

DELETE http://MyDomain.com:8019/api.rsc/tasks

Query Parameters

Name Description
JobName (required) Specifies the name of the job.
TaskId (required) Specifies the task to delete.