Description

Edit a cron job.

Arguments

token (Required)
You API token. Check authentication section for details.
id (Required)
ID of the cron job you want to edit.
url (Optional)
URL of the cron job. Maximum length is 1024 chars.
cron_expression (Optional)
Cron expression that following the syntax defined at our Cron Expression page.
cron_job_name (Optional)
The name of your cron job. Maximum length is 100 chars.
description (Optional)
The description of your cron job. Maximum length is 1024 chars.
auth_user (Optional)
HTTP basic authentication user. Maximum length is 50 chars.
auth_pw (Optional)
HTTP basic authentication password. Maximum length is 50 chars.
custom_timeout (Optional)
The max allowed execution time (in second) of your cron job. Execeeding this time, your cron job will time out and be marked as "failed". Allowed values:
0 to your plan's default timeout.
criterion (Optional)
The rules for considering if an execution of cron job succeeded or failed. Allowed values:
1 Consider execution succeeded when the HTTP code is 2xx.
2 Consider execution succeeded when the HTTP code is 2xx and the HTTP body messge matches success_regexp.
3 Consider execution failed when the HTTP code is 2xx and the HTTP body messge matches failure_regexp.
success_regexp (Optional)
The regular expression to match when criterion is set to 2. When criterion is not 2, this argument will be ignored. Maximum length is 255 chars.
failure_regexp (Optional)
The regular expression to match when criterion is set to 3. When criterion is not 3, this argument will be ignored. When the Maximum length is 255 chars.
email_me (Optional)
Email notification setting of the cron job. Allowed values:
0: never send email notification.
1: send email if execution fails or returns to success from failure.
sensitivity (Optional)
Only after encountering this amount of failures, the failure notification email will get sent. Allowed values:
1 to 5.
group_id (Optional)
Integral group ID of the cron job. You could find the group ID of a group in the "Group View" on our website.
If this argument equals to 0, the cron job will be made to belong to no group.
If this argument is absent, no change will be made to group ownership of this cron job.
http_method (Optional)
HTTP method that your cron job HTTP requests will use. e.g. POST. Valid methods include "GET", "POST", "HEAD", "PUT", "PATCH", "DELETE", "CONNECT", "OPTIONS" and "TRACE".
Default to GET.
http_headers (Optional)
HTTP headers that your cron job HTTP requests will use.
posts (Optional)
The data to send for HTTP method "POST", "PUT" and "PATCH". It contains variable-value pairs. e.g. param1=val1&param2=val2. Maximum length is 1024 chars. This argument only take affect if HTTP method is set to "POST", "PUT" or "PATCH".
wh (Optional)
Webhook notification setting of the cron job. Allowed values:
0: never send webhook notification.
1: send webhook if execution fails.
2: send webhook after each execution.
wh_url (Optional. If augument "wh" equals 1 or 2, "wh_url" is required.)
URL that the webhook request is sent to. Maximum length is 1024 chars.
wh_http_method (Optional)
HTTP method that your cron job webhook requests will use. e.g. POST. Valid methods include "GET", "POST", "HEAD", "PUT", "PATCH", "DELETE", "CONNECT", "OPTIONS" and "TRACE".
Default to GET.
wh_data[] (Optional)
Information that your cron job webhook requests will send. Valid values include "CRON_JOB_ID", "CRON_JOB_NAME", "CRON_JOB_URL", "CRON_JOB_EXECUTION_STATUS", "CRON_JOB_HTTP_STATUS_CODE" and "CRON_JOB_EXECUTION_ERROR".
E.g. wh_data[]=CRON_JOB_ID&wh_data[]=CRON_JOB_NAME will cause webhook requests include the cron job ID and name information.

Example Request

https://www.easycron.com/rest/edit?token=[token]&id=2107&cron_expression=* * * * *&url=http%3A%2F%2Fwww.domain.com%2Fsendemails

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

Example Success Response (in JSON format)

{"status":"success","cron_job_id":"2107"}

Above example response is equal to the following array:

Array
(
    [status] => success
    [cron_job_id] => 2107
)

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 there is something wrong with the arguments, you may receive other errors:

code: 2

message: Cron job name is too long.

code: 3

message: The cron expression you entered is invalid or it cannot be matched in a realitic future.

code: 9

message: The value of "email me" field is not valid.

code: 10

message: You don't have enough privilege to perform the request. You need to upgrade to a paid plan to use the "email me" feature.

code: 12

message: The execution interval cannot be lower than [mininmumMinuteInterval] minutes. You can upgrade your plan to a paid plan to remove this limit.

code: 13

message: The URL format is wrong.

code: 14

message: The domain is prohibited to be added by free user.

code: 23

message: You don't have enough EPDs to update the cron job.

code: 24

message: An error occured when updating the cron job.

code: 25

message: The cron job ID is invalid.

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

code: 26

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

code: 31

message: The value of "POST" field is too long (longer than 1024).

code: 33

message: The URL is too long (longer than 1024).

code: 34

message: You need to upgrade to a Plus or higher plan to customize your HTTP method (to method other than "GET").

code: 35

message: You need to upgrade to a Plus or higher plan to customize your HTTP headers.

code: 36

message: The HTTP method you set is incorrect.

code: 37

message: The value of "HTTP headers" field is too long (longer than 10K).

code: 38

message: Invalid cron job group.

code: 39

message: Your plan has expired. Please renew your plan first.

code: 40

message: Your HTTP auth user is too long (longer than 50 chars).

code: 41

message: Your HTTP auth password is too long (longer than 50 chars).

code: 42

message: The value of "sensitivity" field is not valid.

code: 43

message: The value of "Cron job timeout" field is invalid.

code: 44

message: The value of "Cron job timeout" field cannot be longer than XXXX seconds (your plan's default timeout).

code: 45

message: The description is too long (longer than 1024).

code: 47

message: Invalid option for augument "wh".

code: 48

message: You need to upgrade to a Enterprise plan to use "webhook" feature.

code: 49

message: You should add a webhook URL.

code: 50

message: Your webhook URL is invalid.

code: 51

message: Your webhook URL is too long (longer than 1024 chars).

code: 52

message: Invalid webhook HTTP method.

code: 53

message: Augument "wh_data" should be in array format (e.g. "wh_data[]").

code: 54

message: The domain is prohibited to be added.

code: 55

message: You need to upgrade your plan to use the "output matching" feature.

code: 56

message: Success regular expression is too long (longger than 255 chars)

code: 57

message: Invalid success regular expression: ERROR_DESCRIPTION

code: 58

message: Failure regular expression is too long (longger than 255 chars)

code: 59

message: Invalid failure regular expression: ERROR_DESCRIPTION