cron.*

cron.list

List all cronjobs under your account.

Parameters Bold parameters are required.

Name Type Default Description
token string none Your API token

Response data

Result data will contains an array/collection of cronjob data structure.

cron.get

Get one cronjob's information

Parameters Bold parameters are required.

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,"minute":["41"],"hour":["3"],"day":["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"],"month":["1","2","3","4","5","6","7","8","9","10","11","12"],"weekday":["2"],"timezone":"Europe\/London","url":"http:\/\/example.com\/cron.php","postData":"","fail":0,"status":0,"name":"weekly","notify":0,"points":1},"info":[],"status":"success","code":0}

cron.add

Add a new cronjob

Parameters Bold parameters are required.

Name Type Default Description
token string none Your API token
url string none URL to call
second array(string)
comma separated string
0 Second values
minute array(string)
comma separated string
random 0 - 59 Minute values
hour array(string)
comma separated string
range(0, 23) Hour values
day array(string)
comma separated string
range(1, 31) Day values
month array(string)
comma separated string
range(1, 12) Month values
weekday array(string)
comma separated string
range(1, 7) Weekday values
expression string '' (empty) Time expression, may be either crontab syntax or time interval in English
timezone string account timezone Cronjob timezone
httpMethod string GET HTTP method of the HTTP request to send to your cronjob URL
httpHeaders string '' (empty) Headers of the HTTP request to send to your cronjob URL.
postData string '' (empty) Data to POST to your URL if httpMethod is POST or PUT.
notify integer 0 (NOTIFY_NEVER) Notification settings
notifyEvery integer 1 Number of failures before we notify you agaiin, if notify is set to NOTIFY_FAILURE
failureThreshold integer 10 Number of failures allowed before we disable your failed cronjob.
pattern string '' (empty) We'll notify you when your cronjob output match this pattern.
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.setcronjob.com/api/cron.add?token=******&minute=10,20,30&hour=1,2,3&url=http%3A%2F%2Fexample.com%2Fcron.php
https://www.setcronjob.com/api/cron.add?token=******&expression=*/3 1,2,3 * * *&url=http%3A%2F%2Fexample.com%2Fcron.php

Example response

{"data":{"id":132,"group":null,"minute":["10","20","30"],"hour":["1","2","3"],"day":["1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"],"month":["1","2","3","4","5","6","7","8","9","10","11","12"],"weekday":["1","2","3","4","5","6","7"],"timezone":"UTC","url":"http:\/\/example.com\/cron.php","postData":"","fail":0,"status":0,"name":"","notify":0,"points":9},"info":[],"status":"success","code":0}

cron.edit

Update an existing cronjob

Parameters Bold parameters are required.

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 updated cronjob.

cron.enable

Enable a cronjob

Parameters Bold parameters are required.

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

Response data

You'll get the structure of updated cronjob.

cron.disable

Disabled a cronjob

Parameters Bold parameters are required.

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

Response data

You'll get the structure of updated cronjob.

cron.delete

Delete a cronjob

Parameters Bold parameters are required.

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

Response data

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

cron.run

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

Parameters Bold parameters are required.

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 Bold parameters are required.

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.