Get Cron Details

As the cron creation is done in the previous section, you can obtain the details of an existing cron using the cron Id. The cron reference used in the below code snippets is the component instance.

Get a Single Cron Details

The details of a particular cron can be fetched by passing the cron ID to the getCronDetails() method.

A promise returned here will be resolved to an object which is a JSON.

Copied//Get a single cron in the project using the Cron ID
let cron = app.cron();
let cronPromise = cron.getCronDetails(1510000000113355);
cronPromise.then((cronObject) => {
            console.log(cronObject);
        });

A sample response that you will receive for each version is shown below:

Node.js

Copied{
  cron_name: "ZylkerCron",
  cron_type: "OneTime",
  cron_url_details: {
    url_id: 2136000000013063,
    url: "https://www.zoho.com/catalyst/help/",
    headers: {},
    params: {},
    request_method: "GET"
  },
  status: true,
  created_time: "Aug 16, 2021 07:09 PM",
  created_by: {
    zuid: 66466723,
    is_confirmed: false,
    email_id: "emma@zylker.com",
    first_name: "Amelia",
    last_name: "Burrows",
    user_type: "Admin",
    user_id: 2136000000006003
  },
  modified_time: "Aug 16, 2021 07:09 PM",
  modified_by: {
    zuid: 66466723,
    is_confirmed: false,
    email_id: "emma@zylker.com",
    first_name: "Amelia",
    last_name: "Burrows",
    user_type: "Admin",
    user_id: 2136000000006003
  },
  project_details: { project_name: "AlienCity", id: 2136000000007733 },
  end_time: -1,
  job_detail: {
    time_of_execution: 1629207599387,
    hour: 0,
    minute: 0,
    second: 0,
    timezone: "America/Los_Angeles"
  },
  success_count: 0,
  failure_count: 0,
  id: 2136000000013066
}
Copied{
  cron_name: "ZylkerCron",
  cron_type: "OneTime",
  cron_url_details: {
    url_id: "2136000000013063",
    url: "https://www.zoho.com/catalyst/help/",
    headers: {},
    params: {},
    request_method: "GET"
  },
  status: true,
  created_time: "Aug 16, 2021 07:09 PM",
  created_by: {
    zuid: "66466723",
    is_confirmed: false,
    email_id: "emma@zylker.com",
    first_name: "Amelia",
    last_name: "Burrows",
    user_type: "Admin",
    user_id: "2136000000006003"
  },
  modified_time: "Aug 16, 2021 07:09 PM",
  modified_by: {
    zuid: "66466723",
    is_confirmed: false,
    email_id: "emma@zylker.com",
    first_name: "Amelia",
    last_name: "Burrows",
    user_type: "Admin",
    user_id: "2136000000006003"
  },
  project_details: { project_name: "AlienCity", id: "2136000000007733" },
  end_time: "-1",
  job_detail: {
    time_of_execution: 1629207599387,
    hour: 0,
    minute: 0,
    second: 0,
    timezone: "America/Los_Angeles"
  },
  success_count: 0,
  failure_count: 0,
  id: "2136000000013066"
}

Get All Cron Details

When there is a need to fetch the details of all the cron created in a catalyst project, this particular method getCron() is used.

The promise returned here will be resolved into an array of objects.

Copied//Get all crons in the project by calling getAllCron()
let cron = app.cron();
let allCronPromise = cron.getAllCron();
allCronPromise.then((cronObject) => {
            console.log(cronObject);
        });

A sample response that you will receive for each version is shown below:

Node.js

Copied[
   {
      "cron_name":"ZylkerCron",
      "cron_type":"OneTime",
      "cron_url_details":{
         "url_id":2136000000037059,
         "url":"https://www.zoho.com/catalyst/help/",
         "headers":{
         },
         "params":{
         },
         "request_method":"GET"
      },
      "status":true,
      "created_time":"Aug 25, 2021 11:45 AM",
      "created_by":{
         "zuid":66466723,
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":2136000000006003
      },
      "modified_time":"Aug 25, 2021 11:45 AM",
      "modified_by":{
         "zuid":66466723,
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":2136000000006003
      },
      "project_details":{
         "project_name":"AlienCity",
         "id":2136000000007733
      },
      "end_time":-1,
      "job_detail":{
         "time_of_execution":1629958533374,
         "hour":0,
         "minute":0,
         "second":0,
         "timezone":"America/Los_Angeles"
      },
      "success_count":0,
      "failure_count":0,
      "id":2136000000037062
   },
   {
      "cron_name":"Calendar_Cron",
      "cron_type":"Calendar",
      "cron_url_details":{
         "url_id":2136000000013123,
         "url":"https://www.zoho.com/catalyst/help/",
         "headers":{
         },
         "params":{
            "userId":1
         },
         "request_method":"GET"
      },
      "status":true,
      "created_time":"Aug 16, 2021 07:58 PM",
      "created_by":{
         "zuid":66466723,
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":2136000000006003
      },
      "modified_time":"Aug 16, 2021 07:58 PM",
      "modified_by":{
         "zuid":66466723,
         "is_confirmed":false,
         "email_id":"surya.p+local@zohotest.com",
         "first_name":"Surya",
         "last_name":"Prakash",
         "user_type":"Admin",
         "user_id":2136000000006003
      },
      "project_details":{
         "project_name":"AlienCity",
         "id":2136000000007733
      },
      "end_time":-1,
      "job_detail":{
         "hour":8,
         "minute":0,
         "second":0,
         "repetition_type":"Daily",
         "timezone":"America/Los_Angeles"
      },
      "success_count":0,
      "failure_count":9,
      "id":2136000000013126
   },
   {
      "cron_name":"Periodic_Cron",
      "cron_type":"Periodic",
      "cron_url_details":{
         "url_id":2136000000013099,
         "url":"https://www.zoho.com/catalyst/help/",
         "headers":{
         },
         "params":{
            "userId":1
         },
         "request_method":"GET"
      },
      "status":false,
      "created_time":"Aug 16, 2021 07:22 PM",
      "created_by":{
         "zuid":66466723,
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":2136000000006003
      },
      "modified_time":"Aug 16, 2021 07:22 PM",
      "modified_by":{
         "zuid":66466723,
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":2136000000006003
      },
      "project_details":{
         "project_name":"AlienCity",
         "id":2136000000007733
      },
      "end_time":-1,
      "job_detail":{
         "hour":1,
         "minute":0,
         "second":0,
         "timezone":"America/Los_Angeles"
      },
      "success_count":0,
      "failure_count":51,
      "id":2136000000013102
   }
]
Copied[
   {
      "cron_name":"ZylkerCron",
      "cron_type":"OneTime",
      "cron_url_details":{
         "url_id":"2136000000037059",
         "url":"https://www.zoho.com/catalyst/help/",
         "headers":{
         },
         "params":{
         },
         "request_method":"GET"
      },
      "status":true,
      "created_time":"Aug 25, 2021 11:45 AM",
      "created_by":{
         "zuid":"66466723",
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":"2136000000006003"
      },
      "modified_time":"Aug 25, 2021 11:45 AM",
      "modified_by":{
         "zuid":"66466723",
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":"2136000000006003"
      },
      "project_details":{
         "project_name":"AlienCity",
         "id":"2136000000007733"
      },
      "end_time":"-1",
      "job_detail":{
         "time_of_execution":1629958533374,
         "hour":0,
         "minute":0,
         "second":0,
         "timezone":"America/Los_Angeles"
      },
      "success_count":0,
      "failure_count":0,
      "id":"2136000000037062"
   },
   {
      "cron_name":"Calendar_Cron",
      "cron_type":"Calendar",
      "cron_url_details":{
         "url_id":"2136000000013123",
         "url":"https://www.zoho.com/catalyst/help/",
         "headers":{
         },
         "params":{
            "userId":1
         },
         "request_method":"GET"
      },
      "status":true,
      "created_time":"Aug 16, 2021 07:58 PM",
      "created_by":{
         "zuid":"66466723",
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":"2136000000006003"
      },
      "modified_time":"Aug 16, 2021 07:58 PM",
      "modified_by":{
         "zuid":"66466723",
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":"2136000000006003"
      },
      "project_details":{
         "project_name":"AlienCity",
         "id":"2136000000007733"
      },
      "end_time":"-1",
      "job_detail":{
         "hour":8,
         "minute":0,
         "second":0,
         "repetition_type":"Daily",
         "timezone":"America/Los_Angeles"
      },
      "success_count":0,
      "failure_count":9,
      "id":"2136000000013126"
   },
   {
      "cron_name":"Periodic_Cron",
      "cron_type":"Periodic",
      "cron_url_details":{
         "url_id":"2136000000013099",
         "url":"https://www.zoho.com/catalyst/help/",
         "headers":{
         },
         "params":{
            "userId":1
         },
         "request_method":"GET"
      },
      "status":false,
      "created_time":"Aug 16, 2021 07:22 PM",
      "created_by":{
         "zuid":"66466723",
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":"2136000000006003"
      },
      "modified_time":"Aug 16, 2021 07:22 PM",
      "modified_by":{
         "zuid":"66466723",
         "is_confirmed":false,
         "email_id":"emma@zylker.com",
         "first_name":"Amelia",
         "last_name":"Burrows",
         "user_type":"Admin",
         "user_id":"2136000000006003"
      },
      "project_details":{
         "project_name":"AlienCity",
         "id":"2136000000007733"
      },
      "end_time":"-1",
      "job_detail":{
         "hour":1,
         "minute":0,
         "second":0,
         "timezone":"America/Los_Angeles"
      },
      "success_count":0,
      "failure_count":51,
      "id":"2136000000013102"
   }
]