cron_*

Available functions

cron_list

List cronjobs under your account, up to 1000 items per page.

Parameters

Name Type Default Description
token string none Your API token
page int 1 Page number
keyword string none Keyword to search cronjobs (name, ID, URL)

Response data

Result data contains an array/collection of cronjob data structures.

cron_get

Get a cronjob data

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID

Response data

You'll get the cronjob data structure.

Example response

{"data":{"id":132,"group":null,"expression":"41 3 * * 2","timezone":"Europe\/London","url":"http:\/\/example.com\/cron_php","postData":"","fail":0,"status":0,"name":"weekly","notify":true,,"points":1},"info":[],"status":"success","code":0}

cron_add

Add a new cronjob

Parameters

Name Type Default Description
token string none Your API token
url string none URL to call
expression string '' (empty) Time expression, may be either crontab syntax or time interval in English
timezone string account timezone Cronjob timezone
timeout integer plan timeout Cron timeout - max time to wait for your URL to response.
instances integer 0 Set max overlapping cronjob executions:
  • 0: unlimited (allows overlapping executions)
  • 1: single (no overlapping executions)
  • 2+: 2+ overlapping executions
username string '' (empty) Username for HTTP authentication
password string '' (empty) Password for HTTP authentication
httpMethod string GET HTTP method of the HTTP request to send to your cronjob URL
postData string '' (empty) When httpMethod is POST or PUT, send this post data with the HTTP request.
httpHeaders string '' (empty) Plain HTTP headers to send to your cronjob URL. Use new lines as delimiters, e.g.
X-API-Key: 123ABC456XYZ
Header2: test-value
notify bool true Enable notification on failure.
notifyEvery int 1 When notify is true, send notification every notifyEvery fails.
ignoreHttpStatus boolean true True to not check your cron execution's HTTP result.
retryFailed boolean true True to allow to keep trying failed cronjob.
failureThreshold integer 10 Number of failures allowed before we disable your failed cronjob.
pattern string '' (empty) If the cron execution contains the string, mark it as failure
group integer null (None) Group ID
name string '' (empty) Name of cronjob

As you can see, just pass your API token (as always) and cron URL, we'll create an hourly cronjob for you.

Response data

You'll get the structure of newly created cronjob.

Example request

https://www.fastcron.com/api/v1/cron_add?token=******&expression=*/3 1,2,3 * * *&url=example.com/cron_php

Example response

{"data":{"id":132,"group":null,"expression":"*/3 1,2,3 * * *","timezone":"UTC","url":"http:\/\/example.com\/cron_php","postData":"","fail":0,"status":0,"name":"","notify":true,,"points":9},"info":[],"status":"success","code":0}

cron_edit

Update an existing cronjob

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID
whatever(s) whatever(s) existing value(s) Any parameter(s) listed in cron_add parameters

Similar to cron_add, except that it'll update a specific cronjob with provided ID.

Response data

You'll get the structure of the updated cronjob.

cron_enable

Enable a cronjob

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID

Response data

You'll get the structure of the updated cronjob.

cron_disable

Disable a cronjob

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID

Response data

You'll get the structure of the updated cronjob.

cron_pause

Pause a cronjob for a specific duration

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID
for string none An expression for time modification e.g. 15 minutes, 1 hour, 1 day, etc.

Response data

You'll get the structure of the paused cronjob.

cron_delete

Delete a cronjob

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID

Response data

You'll get the structure of the deleted cronjob, with ID set to null.

cron_run

Schedule the cronjob to run within next minute. This doesn't change the cronjob time settings.

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID

Response data

You'll get the timestamp which cronjob will run at.

cron_logs

Get your cronjob execution logs.

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID

Response data

You'll get an array/collection of cron execution results data structures.

cron_failures

Get your cronjob(s) failed execution logs.

Parameters

Name Type Default Description
token string none Your API token
id integer none Cronjob ID

Response data

You'll get an array/collection of cron execution results data structures.

If no id is provided, it will return an array of all cronjobs' failure logs.

cron_batch_add

Add multiple cronjobs at once. This works only with requests in JSON format.

Parameters

Name Type Default Description
token string none Your API token
data array none Array of cron_add parameters except token.

Sample API request

curl -X POST "https://www.fastcron.com/api/v1/cron_batch_add" \
-H 'Content-Type: application/json' \
-d '{"token":"***", "data":[{"url":"https://example.com", "expression":"1 hour"},{"url":"https://example.com", "expression":"1 day"}]}'
            

Response data

Result data contains an array/collection of cronjob data structures.

cron_batch_edit

Update multiple cronjobs at once.

Parameters

Name Type Default Description
token string none Your API token
id array none List of cronjob IDs
whatever(s) whatever(s) existing value(s) Any parameter(s) listed in cron_add parameters except token

Response data

Result data contains an array/collection of updated cronjob data structures.

cron_batch_delete

Delete multiple cronjobs at once.

Parameters

Name Type Default Description
token string none Your API token
id array none List of cronjob IDs

Response data

Result data contains an array/collection of deleted cronjobs.

cron_group_edit

Update multiple cronjobs in a group at once.

Parameters

Name Type Default Description
token string none Your API token
id int The group ID
whatever(s) whatever(s) existing value(s) Any parameter(s) listed in cron_add parameters except token

Response data

Result data contains an array/collection of updated cronjob data structures.