Create Job

Using the following SDK method, you can create and submit Jobs to trigger Job Functions, Webhooks, Circuits, and App Sail services. You can also pass optional arguments in the form of JSON key value pairs.

SDK snippet to create and submit Job to trigger:

    
copy

// create function job const functionJob = await jobScheduling.JOB.submitJob({ job_name: ’test_job’, // set a name for the job jobpool_name: ’test’, // set the name of the Function jobpool where the job should be submitted target_type: ‘Function’, // set the target type as Function for function jobs target_name: ’target_function’, // set the target function’s name (optional) (either target_id or target_name is mandatory) // target_id: ‘123467890’, // set the target functions’s Id (optional) (either target_id or target_name is mandatory) params: { arg1: ’test’, arg2: ‘job’ }, // set params to be passed to target function (optional) job_config: { number_of_retries: 2, // set the number of retries retry_interval: 15 * 60 // set the retry interval } // set job config - job retries => 2 retries in 15 mins (optional) });

    
copy

// create circuit job const circuitJob = await jobScheduling.JOB.submitJob({ job_name: ’test_job’, // set a name for the job jobpool_name: ’test’, // set the name of the Circuit jobpool where the job should be submitted target_type: ‘Circuit’, // set the target type as Circuit for circuit jobs target_name: ’target_circuit’, // set the target circuit’s name (optional) (either target_id or target_name is mandatory) // target_id: ‘123467890’, // set the target circuit’s Id (optional) (either target_id or target_name is mandatory) test_cases: { arg1: “job”, arg2: “test” }, // set the circuit test cases job_config: { number_of_retries: 2, // set the number of retries retry_interval: 15 * 60 // set the retry interval } // set job config - job retries => 2 retries in 15 mins (optional) });

    
copy

// create webhook job const webhookJob = await jobScheduling.JOB.submitJob({ job_name: ’test_job’, // set a name for the job jobpool_name: ’test’, // set the name of the Webhook jobpool where the job should be submitted target_type: ‘Webhook’, // set the target type as Webhook for webhook jobs request_method: ‘POST’, // set the webhook request’s method url: ‘https://catalyst.zoho.com’, // set the webhook request’s url params: { arg1: ’test’, arg2: ‘job’ }, // set the webhook request’s query params (optional) headers: { IS_TEST_REQUEST: ’true’ }, // set the webhook request’s headers (optional) request_body: ’test_request’, // set the webhook request’s body (optional) job_config: { number_of_retries: 2, // set the number of retries retry_interval: 15 * 60 // set the retry interval } // set job config - job retries => 2 retries in 15 mins (optional) });

    
copy

// create appsail job const appsailJob = await jobScheduling.JOB.submitJob({ job_name: ’test_job’, // set a name for the job jobpool_name: ’test’, // set the name of the AppSail jobpool where the job should be submitted target_type: ‘AppSail’, // set the target type as AppSail for appsail jobs target_name: ’target_appsail’, // set the target appsail’s name (optional) (either target_id or target_name is mandatory) // target_id: ‘123467890’, // set the target appsail’s Id (optional) (either target_id or target_name is mandatory) request_method: ‘POST’, // set the appsail request’s method url: ‘/test’, // set the appsail’s url path (optional) params: { arg1: ’test’, arg2: ‘job’ }, // set the appsail request’s query params (optional) headers: { IS_TEST_REQUEST: ’true’ }, // set the appsail request’s headers (optional) request_body: ’test_request’, // set the appsail request’s body (optional) job_config: { number_of_retries: 2, // set the number of retries retry_interval: 15 * 60 // set the retry interval } // set job config - job retries => 2 retries in 15 mins (optional) });

Last Updated 2025-06-20 16:21:48 +0530 +0530