This API creates a job by accepting one or more job schedules to be created.
You cannot create CF tasks using the REST API because they are bound to a specific application. For more information, see Can I create a CF task using the REST API?.
POST /scheduler/jobs
BODY
Parameter |
Required |
Data Type |
Description |
---|---|---|---|
|
Yes |
string |
Name of the job. Name must not contain special characters or only numbers.
|
|
Yes |
string |
Provides more details about a job. |
|
Yes |
string |
The fully qualified URL endpoint to be called when the job runs.
|
|
Yes |
boolean |
Activation status of the job (default value is false). |
|
Yes |
string |
The HTTP method to be used to call the job action endpoint URL. Allowed values are “GET”, “POST” , “PUT”, and “DELETE”. |
|
No |
string/object/null |
Start time for the job. The scheduler respects the start time of both the schedule and the job. For more information about the supported formats, see Date and Time Format. |
|
Yes |
string/object/null |
End time for the job. The scheduler respects the end time of both the schedule and the job. For more information about the supported formats, see Date and Time Format. |
|
No |
object |
The
|
|
Yes |
array |
Contains one or more job schedules to be created. |
The schedules array can be used to create job schedules. Each job schedule is composed of the following parameters: |
|||
|
No |
object |
Data value is passed to the job action endpoint when invoked by Job Scheduler. For the HTTP method “PUT” or “POST”, the data parameters are sent in the request body while invoking the endpoint. For the HTTP method “GET” or “DELETE”, the data parameters are sent as query strings. |
|
No |
string |
Provides more details about a schedule. |
|
Yes |
boolean |
Activation status of the job schedule. The allowed values are true or false. |
|
No |
string/object |
Start time for the job schedule. For information about the supported formats, see the section on Date and Time Format. |
|
No |
string/object |
End time for the job schedule. For information about the supported formats, see the section on Date and Time Format. |
|
|||
|
- |
string |
Crontab pattern for triggering the schedule. For more information, see the section on Cron Format. |
|
- |
string/object |
If an object is used, you must specify the date and time formats as strings. For information about the supported formats, see the section on Date and Time Format. |
|
- |
string |
Used to run schedules repeatedly at some interval. Human-readable texts must comply with the rules outlined for human readable dates. For information about the supported formats, see the section on For one-time schedules, this denotes the task execution time. You can use human-readable text to denote a specific time. Example: "3.30pm", "tomorrow at 2am". For information about human readable dates and the supported readable strings, see the section on Date and Time Format. |
|
- |
string |
For recurring schedules, this denotes the exact time when the job schedule must run. The human readable strings must comply with the rules outlined in the section Human Readable Dates. For information about human readable dates and the supported readable strings, see the section on Date and Time Format. |
POST /scheduler/jobs
For one-time schedules, this denotes the task execution time.
{
"name": "validateSalesOrder",
"description": "cron job that validates sales order requests",
"action": "http://salesOrderApp.hana.ondemand.com:40023/salesOrders/validate",
"active": true,
"httpMethod": "PUT",
"ansConfig": {
"onError": false,
"onSuccess": false
},
"schedules": [
{
"cron": "* * * * * */10 0",
"description": "this schedule runs every 10 minutes",
"data": {
"salesOrderId": "1234"
},
"active": true,
"startTime": {
"date": "2015-10-20 04:30 +0000",
"format": "YYYY-MM-DD HH:mm Z"
}
}
]
}
The call was successful and the Job has been created. The API responds with a Location header which represents the relative resource URI for finding the job details.
{
"name": "validateSalesOrder",
"action": "http://<application-url>/action",
"active": true,
"httpMethod": "PUT",
"description": "cron job that validates sales order requests",
"startTime": null,
"endTime": null,
"signatureVersion": 0,
"schedules": [
{
"active": true,
"startTime": "2015-10-20 04:30:00",
"endTime": null,
"description": "every 10 seconds, every 2 minutes",
"data": "{\"salesOrderId\":\"1234\"}",
"cron": "* * * * * * */10",
"type": "recurring",
"scheduleId": "schedule ID details"
}
],
"_id": 3
}
The API was unable to process the request due to invalid data provided.
Related Information