- URL:
- https://<root>/system/tasks/createTask
- Methods:
POST
- Required Capability:
- Access allowed only with the default administrator role
- Version Introduced:
- 10.9.1
Description
The create
operation creates scheduled tasks for a deployment that run automatically. Once the task has been created, it can be updated using the Update operation. In addition, scheduled tasks can be disabled, reenabled, and deleted using other operations in the ArcGIS Enterprise Administrator API.
Request parameters
Parameter | Details |
---|---|
(Optional) | The title of the task. Example
|
(Required) | The task type. Currently, this must be set to Example
|
(Required) | A JSON object of additional parameters that will be added to the task run request. For
Example
|
(Optional) | The date, defined in epoch milliseconds (Unix time), the task will begin running. Example
|
(Optional) | The date, defined in epoch milliseconds (Unix time), the task will stop running. Example
|
(Required) | A valid CRON expression ( Example
|
(Required) | A valid CRON expression ( Example
|
(Required) | A valid CRON expression ( Example
|
(Required) | A valid CRON expression ( Example
|
(Required) | A valid CRON expression ( Example
|
(Optional) | The maximum number of occurrences the task will execute. Example
|
| The response format. The default format is Values: |
CRON expressions
Special characters and wildcards can be used to customize scheduled jobs. The following table lists the supported characters:
Character | Details |
---|---|
| Specifies all values. |
| No specific value for |
| A range. |
| A list of additional values. |
| Specifies increments. |
| The nth day name of the month (applies only to |
| The last day of the week or month. |
| The weekday (Monday-Friday) nearest the given day (applies only to |
| The last weekday of the month. |
The following table shows sample schedules and how they translate to CRON values for the minute
, hour
, day
, month
, and day
parameters:
Schedule | minute | hour | dayOfMonth | month | dayOfWeek |
---|---|---|---|---|---|
Hourly at 15 minutes past the hour | 15 | * | * | * | ? |
Every four hours during weekdays | 0 | */4 | ? | * | 1-5 |
Weekly on Sundays at 12:00 p.m. | 0 | 12 | ? | * | 7 |
Twice a month on the 1st and 15th at 12:00 a.m. | 0 | 0 | 1,15 | * | ? |
Last Friday of every month at 10:00 p.m. | 0 | 22 | ? | * | 6L |
Last day of the month at 10:00 p.m. | 0 | 22 | L | * | ? |
Last weekday of the month at 6:00 p.m. | 0 | 18 | LW | * | ? |
Closest weekday to the 15th of each month at midnight | 0 | 0 | 15W | * | ? |
Example usage
The following is a sample POST request for the create
operation that demonstrates scheduling a Create
task that will run weekly on Sundays at 12:00 a.m.:
POST /context/admin/system/tasks/createTask HTTP/1.1
Host: organization.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []
title=backups&type=CreateBackup¶meters={"name": "myBackup","passcode": "myPassword","storeName": "backups","metaData": {"recurring": false,"startTime": "04:00","retention": {"type": "day","value": 14}},"retentionOffset": 1209600000}&startDate=1589428800000&endDate=1589428800000&minute=0&hour=0&dayOfMonth=?&month=*&dayOfWeek=7&maxOccurrences=1&f=pjson&token=HRozb6bnTL6gfA-SJO-IxhfLgJrioK1KJdMLWmCE5HjHWz9U3fOiFv3-HkgPZqsLljTkk2WDENGt5fjho5s39e_mZL5At60UvJPoNnC5O2sv2HTlumG7TsYfbtnokpWmS6-lf8XoQpSKusZwmxIkEMP-yE0Wxrj8o9sWKi29J-pxzkoCDhoUfdLt6NnBWxhESpegh8BzNcEruqxuDQD-JRmaTsbRDaBHTQTePMzQePhXl7KcEG9Cfkw2sa7P1W1e
JSON Response example
{
"name": "schedule1",
"passcode": "{crypt}3ngE7lQuQGDfaiab4uogjg==",
"storeName": "default",
"itemId": "",
"metaData": {
"recurring": true,
"startTime":" 20:00",
"retention": {
"type": "day",
"value": 14
}
},
"retentionOffset": 1209600000
}