Scheduler

addTask

URL/api/v1/api.php?target=scheduler&action=addTask
DescriptionAdd a new scheduled task. Request is POST-only. Params are a single JSON object:
ReturnsExamples:
SUCCESSFUL: {"success":1,"message":"Message "}
ERROR: {"success":0, "message":"Error Message"}>
Required Parameters
Name
Type
Example
Description
user_idINTEGER100User ID
nameSTRINGProcess Holding TankName given to the new
class_nameSTRING\scheduler\Tasks\ProcessHoldingTask
PHP-namespaced name for the task class.
Currently available:
 \scheduler\Tasks\ProcessHoldingTask
 \scheduler\Tasks\BackupTask
 \scheduler\Tasks\DNSPushTask
data
{}
activeBOOLtrue
repeat_items


Optional Parameters
Name
Type
Example
Description
repeat_startSTRING2015-05-06Date to start repeating task. Date must be in YYYY-MM-DD format.
repeat_endSTRINGnullDate to end repeating task or null. Date must be in YYYY-MM-DD format.
repeat_hourINTEGER8Hour of day to repeat, from 0-23
repeat_minuteINTEGER

0

Minute of that hour to repeat, from 0-59
repeat_dayINTEGER1Day of month, from 1-31
repeat_weekINTEGER1Week of month, from 1-5
repeat_weekdayINTEGER1Days to repeat. Sun-Sat are from 0-6 respectively



updateTask

URL/api/v1/api.php?target=scheduler&action=updateTask
DescriptionUpdate a scheduler task
ReturnsExamples:
SUCCESSFUL: {"success":1,"message":"Message"}
ERROR: {"success":0, "message":"Error Message"}>
Required Parameters
Name
Type
Example
Description
idINTEGER4ID of the task to be updated
user_idINTEGER100User ID
nameSTRINGProcess Holding TankName given to the new
class_nameSTRING\scheduler\Tasks\ProcessHoldingTask
PHP-namespaced name for the task class.
Currently available:
 \scheduler\Tasks\ProcessHoldingTask
 \scheduler\Tasks\BackupTask
 \scheduler\Tasks\DNSPushTask
data
{}
activeBOOLtrue
repeat_items


Optional Parameters
Name
Type
Example
Description
repeat_startSTRING2015-05-06Date to start repeating task. Date must be in YYYY-MM-DD format.
repeat_endSTRINGnullDate to end repeating task or null. Date must be in YYYY-MM-DD format.
repeat_hourINTEGER8Hour of day to repeat, from 0-23
repeat_minuteINTEGER

0

Minute of that hour to repeat, from 0-59
repeat_dayINTEGER1Day of month, from 1-31
repeat_weekINTEGER1Week of month, from 1-5
repeat_weekdayINTEGER1Days to repeat. Sun-Sat are from 0-6 respectively


deleteTask

URL/api/v1/api.php?target=scheduler&action=deleteTask
DescriptionDelete a scheduler task
ReturnsExamples:
SUCCESSFUL: {"success":1,"message":"Task \"New Task\" (2) deleted","data":null}
ERROR: {"success":0, "message":"Error Message"}>
Required Parameters
Name
Type
Example
Description
taskIdINTEGER4ID of the task to delete
Optional Parameters

None

Example URL

/api/v1/api.php?target=scheduler&action=deleteTask&taskId=2


executeTask

URL/api/v1/api.php?target=scheduler&action=executeTask
DescriptionExecute a task immediately
ReturnsExamples:
SUCCESSFUL: {"success":1,"message":"Holding tank processed. 0 IPv4 and 0 IPv6 blocks moved to the available pool. ","data":null}
ERROR: {"success":0, "message":"Error Message"}>
Required Parameters
Name
Type
Example
Description
taskIdINTEGER4ID of the task to run
Optional Parameters

None

Example URL

/api/v1/api.php?target=scheduler&action=executeTask&taskId=1


getTaskHistory

URL/api/v1/api.php?target=scheduler&action=getTaskHistory
Description
Get history for a specific task
ReturnsExamples:
SUCCESSFUL: { "success": 1, "data": [ { "log_id": "1005037", "time": "2015-05-07 12:29:45", "log_level": "6", "user_id": "31", "username": "usernamehere", "log_category": "System", "message": "task_id=1 task=Process Holding Tank action=finished message=Holding tank processed. 0 IPv4 and 0 IPv6 blocks moved to the available pool.", "ip": null }, { "log_id": "1005033", "time": "2015-05-07 12:28:50", "log_level": "6", "user_id": "31", "username": "usernamehere", "log_category": "System", "message": "task_id=1 task=Process Holding Tank action=finished message=Holding tank processed. 1 IPv4 and 0 IPv6 blocks moved to the available pool.", "ip": null }, { "log_id": "1005030", "time": "2015-05-07 12:28:14", "log_level": "6", "user_id": "31", "username": "usernamehere", "log_category": "System", "message": "Task \"Process Holding Tank\" (1) added", "ip": null } ] }
ERROR: {"success":0, "message":"Error Message"}>
Required Parameters
Name
Type
Example
Description
taskIdINTEGER1ID of the task to view
Optional Parameters

None

Example URL

/api/v1/api.php?target=scheduler&action=getTaskHistory&taskId=1


getTasks

URL/api/v1/api.php?target=scheduler&action=getTasks
DescriptionGets a list of scheduled tasks and their repeat settings
Returns

Examples:
SUCCESSFUL: { "success": 1, "data": [ { "id": "1", "user_id": "31", "name": "Process Holding Tank", "class_name": "\\scheduler\\Tasks\\ProcessHoldingTask", "active": true, "data": null, "last_run": "2015-05-07 12:29:45", "repeat_items": [ { "id": "1", "task_id": "1", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "4", "repeat_hour": "20", "repeat_minute": "0" }, { "id": "2", "task_id": "1", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "5", "repeat_hour": "20", "repeat_minute": "0" }, { "id": "3", "task_id": "1", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "6", "repeat_hour": "20", "repeat_minute": "0" }, { "id": "4", "task_id": "1", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "0", "repeat_hour": "20", "repeat_minute": "0" } ] }, { "id": "2", "user_id": "31", "name": "New Task", "class_name": "\\scheduler\\Tasks\\TestTask", "active": true, "data": null, "last_run": "2015-05-07 12:35:41", "repeat_items": [ { "id": "5", "task_id": "2", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "1", "repeat_hour": "21", "repeat_minute": "0" }, { "id": "6", "task_id": "2", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "2", "repeat_hour": "21", "repeat_minute": "0" }, { "id": "7", "task_id": "2", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "3", "repeat_hour": "21", "repeat_minute": "0" }, { "id": "8", "task_id": "2", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "4", "repeat_hour": "21", "repeat_minute": "0" }, { "id": "9", "task_id": "2", "repeat_start": "2015-05-06", "repeat_end": null, "repeat_interval": null, "repeat_year": "*", "repeat_month": "*", "repeat_day": "*", "repeat_week": "*", "repeat_weekday": "5", "repeat_hour": "21", "repeat_minute": "0" } ] } ] }

 
ERROR: {"success":0, "message":"Error Message"}>

Required Parameters

None

Optional Parameters

None

Example URL

/api/v1/api.php?target=scheduler&action=getTasks