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.
cron_job_name (Optional)
The name of your cron job. Maximum length is 100 chars.
cron_expression (Required)
Cron expression that following the syntax defined at our Cron Expression page.
url (Required)
URL of the 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.
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.
log_output_length (Required)
Length of execution log of the cron job. Allowed values:
0: don't log cron job output.
10240: log 10 KB of the cron job output.
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".
via_tor (Optional)
Send requests from EasyCron to your web server via Tor network. Allowed values:
0: don't send via Tor network.
1: send via Tor network.

Example Request

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

In above example, [token] should be replaced with the true token string. The example updates the cron job to run every minute. After each time of execution, the user will get an email notification, 10 KB of cron job output will be saved.

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: 8

message: The value of "log output" field is not valid.

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: 11

message: You don't have enough privilege to perform the request. You need to upgrade to a paid plan to use the "log" 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.

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: 32

message: You need to upgrade to a Max or higher plan to use the Tor network.

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).