Cron Job API Method: list

Description

Get cron jobs of the account.

Arguments

token (Required)
You API token. Check authentication section for details.
group_id (Optional)
Group ID of the cron jobs. Group IDs could be found in the group pages.
If this argument equals to 0, means getting the cron jobs that belong to no group.
page (Optional)
The server serves results page by page. This argument defines the page number of which the cron jobs will be got. Default to 1.
size (Optional)
The max number of cron jobs in one page. Default to 10.
sortby (Optional)
The attribute to sort by. Allowed values:
cronId: cron job ID.
name: cron job name.
url: cron job URL.
epdsOccupied: how many EPDs are occupied by the cron job.
totalSuccesses: total number of successful cron job executions.
totalFailures: total number of failed cron job executions.
failedTime: consecutive failure number.
Default to cronId.
order (Optional)
The order. Allowed values:
desc: descent order.
asc: ascent order.
Default to desc.

Example Request

https://www.easycron.com/rest/list?token=[token]&sortby=cronId&order=desc

In above example, [token] should be replaced with the true token string.

Example Success Response (in JSON format)

{"status":"success","cron_jobs":[{"cron_job_id":"2107","cron_job_name":"Read feeds","description":"Triggers the script to read feeds.","user_id":"1","url":"http:\/\/www.domain.com\/readfeeds","auth_user":"user123","auth_pw":"pw123","cron_expression":"15 1 * * * *","total_successes":"0","total_failures":"0","number_failed_time":"0","epds_occupied":"2","email_me":"1","sensitivity":"1","send_slack":"1","slack_sensitivity":"1","slack_url":"https://hooks.slack.com/services/xxx","group_id":"74","http_method":"GET","http_headers":"","http_message_body":"","custom_timeout":"30","criterion":"2","success_regexp":"succeeded","failure_regexp":"","wh":"0","wh_url":"","wh_http_method":"GET","wh_data":[""],"status":"0","created":"2012-03-19 17:04:18","updated":"2012-08-11 14:25:23"},{"cron_job_id":"1807","cron_job_name":"Backup database","description":"Triggers the script to backup database.","user_id":"1","url":"http:\/\/example.com\/cron\/backupdatabase","auth_user":"user123","auth_pw":"pw123","cron_expression":"55 23 * * * *","total_successes":"0","total_failures":"0","number_failed_time":"0","epds_occupied":"2","email_me":"0","sensitivity":"1","send_slack":"1","slack_sensitivity":"1","slack_url":"https://hooks.slack.com/services/xxx","group_id":"74","http_method":"GET","http_headers":"","http_message_body":"","custom_timeout":"30","criterion":"2","success_regexp":"succeeded","failure_regexp":"","wh":"1","wh_url":"http://example.com/hook.php","wh_http_method":"POST","wh_data":["CRON_JOB_ID","CRON_JOB_NAME"],"status":"0","created":"2012-01-31 10:07:48","updated":"2012-07-19 05:42:32"},{"cron_job_id":"1604","cron_job_name":"Send newsletters","description":"Triggers the script to send newsletters.","user_id":"1","url":"http:\/\/www.domain.com\/sendmails","auth_user":"user123","auth_pw":"pw123","cron_expression":"* * * * * *","total_successes":"0","total_failures":"0","number_failed_time":"0","epds_occupied":"536","email_me":"0","sensitivity":"1","send_slack":"1","slack_sensitivity":"1","slack_url":"https://hooks.slack.com/services/xxx","group_id":"74","http_method":"GET","http_headers":"","http_message_body":"","custom_timeout":"30","criterion":"2","success_regexp":"succeeded","failure_regexp":"","wh":"1","wh_url":"http://example.com/hook.php","wh_http_method":"POST","wh_data":["CRON_JOB_ID","CRON_JOB_NAME"],"status":"0","created":"2011-12-31 20:43:13","updated":"2012-08-11 14:25:55"}]}

Above example response is hard to read, you actually can easily decode it. After decoding it's equal to the following array:

Array
(
    [status] => success
    [cron_jobs] => Array
        (
            [0] => Array
                (
                    [cron_job_id] => 2107
                    [cron_job_name] => Read feeds
                    [description] => Triggers the script to read feeds.
                    [user_id] => 1
                    [url] => http://www.domain.com/readfeeds
                    [auth_user] => user123
                    [auth_pw] => pw123
                    [cron_expression] => 15 1 * * * *
                    [total_successes] => 0
                    [total_failures] => 0
                    [number_failed_time] => 0
                    [epds_occupied] => 2
                    [email_me] => 1
                    [sensitivity] => 1
                    [send_slack] => 1
                    [slack_sensitivity] => 1
                    [slack_url] => https://hooks.slack.com/services/xxx
                    [group_id] => 0
                    [http_method] => GET
                    [http_headers] =>
                    [http_message_body] =>
                    [custom_timeout] => 30
                    [criterion] => 2
                    [success_regexp] => succeeded
                    [failure_regexp] =>
                    [wh] => 0
                    [wh_url] =>
                    [wh_http_method] => GET
                    [wh_data] =>
                    [status] => 0
                    [created] => 2012-03-19 17:04:18
                    [updated] => 2012-08-11 14:25:23
                )

            [1] => Array
                (
                    [cron_job_id] => 1807
                    [cron_job_name] => Backup database
                    [description] => Triggers the script to backup database.
                    [user_id] => 1
                    [url] => http://example.com/cron/backupdatabase
                    [auth_user] => user123
                    [auth_pw] => pw123
                    [cron_expression] => 55 23 * * * *
                    [total_successes] => 0
                    [total_failures] => 0
                    [number_failed_time] => 0
                    [epds_occupied] => 2
                    [email_me] => 0
                    [sensitivity] => 1
                    [send_slack] => 1
                    [slack_sensitivity] => 1
                    [slack_url] => https://hooks.slack.com/services/xxx
                    [group_id] => 74
                    [http_method] => GET
                    [http_headers] =>
                    [http_message_body] =>
                    [custom_timeout] => 30
                    [criterion] => 2
                    [success_regexp] => succeeded
                    [failure_regexp] =>
                    [wh] => 1
                    [wh_url] => http://example.com/hook.php
                    [wh_http_method] => POST
                    [wh_data] => Array(CRON_JOB_ID, CRON_JOB_NAME)
                    [status] => 0
                    [created] => 2012-01-31 10:07:48
                    [updated] => 2012-07-19 05:42:32
                )

            [2] => Array
                (
                    [cron_job_id] => 1604
                    [cron_job_name] => Send newsletters
                    [description] => Triggers the script to send newsletters.
                    [user_id] => 1
                    [url] => http://www.domain.com/sendmails
                    [auth_user] => user123
                    [auth_pw] => pw123
                    [cron_expression] => * * * * * *
                    [total_successes] => 0
                    [total_failures] => 0
                    [number_failed_time] => 0
                    [epds_occupied] => 536
                    [email_me] => 0
                    [sensitivity] => 1
                    [send_slack] => 1
                    [slack_sensitivity] => 1
                    [slack_url] => https://hooks.slack.com/services/xxx
                    [group_id] => 74
                    [http_method] => GET
                    [http_headers] =>
                    [http_message_body] =>
                    [custom_timeout] => 30
                    [criterion] => 2
                    [success_regexp] => succeeded
                    [failure_regexp] =>
                    [wh] => 1
                    [wh_url] => http://example.com/hook.php
                    [wh_http_method] => POST
                    [wh_data] => Array(CRON_JOB_ID, CRON_JOB_NAME)
                    [status] => 0
                    [created] => 2011-12-31 20:43:13
                    [updated] => 2012-08-11 14:25:55
                )

        )

)

Example Error Response (in JSON format)

If you use an invalid token, you may receive following error response:

{"status":"error","error":{"code":"1","message":"Wrong API token."}}

The equal readable array is:

Array
(
    [status] => error
    [error] => Array
        (
            [code] => 1
            [message] => Wrong API token.
        )

)

If you make too much API requests in one day, you may receive following error:

code: 26

message: You have exceeded your max daily API request limit.