- URL:
- https://<root>/system/tasks/<taskID>/update
- Methods:
POST- Version Introduced:
- 10.9
Access requirements
Required privileges
The Enterprise Administrator API requires privilege-based access. An administrator must be assigned a specific user privilege, or role, to access any given endpoint. Listed below are the user privileges or roles an administrator can be assigned that provides access to this endpoint. If multiple privileges are listed, only one needs to be assigned to gain access.
Tokens
This API requires token-based authentication. A token is automatically generated for administrators who sign in to the Enterprise Administrator API directory's HTML interface. Tokens generated in this way are stored for the entirety of the session.
Those accessing the API directory outside of the HTML interface will need to acquire a session token from the generate operation in the Enterprise Directory API. For security reasons, all POST requests made to the Enterprise Administrator API must include a token in the request body.
Description
The update operation allows you to edit and update the properties of a preexisting task (Clean, Backup at 10.9.1, and Create at 10.9.1). Updates that have been made to a task will go into effect during its next scheduled execution.
Request parameters
| Parameter | Details |
|---|---|
| The task's title. Example |
| The type of task. At 10.9, the only task supported was the Values: |
| A JSON object of additional parameters that will be added to the task run request. For Example |
| The task item ID the scheduled task will be run against. This parameter is not required for Example |
| The date, defined in Epoch milliseconds (Unix), of when the scheduled task will begin running. Example |
| The date, defined in Epoch milliseconds (Unix), of when the scheduled task will stop running. Example |
| A valid CRON expression ( Example |
| A valid CRON expression ( Example |
| A valid CRON expression ( Example |
| A valid CRON expression ( Example |
| A valid CRON expression ( Example |
| The maximum number of occurrences this task should execute. Example |
| The response format. The default format is Values: |
CRON expressions
Special characters and wildcards can be used to customize your scheduled jobs. The following table lists the supported characters:
| Character | Details |
|---|---|
| Specifies all values. |
| No specific value for |
| A range. |
| List of additional values. |
| Specifies increments. |
| The nth day name of the month. |
| Last day of the week or month. |
| The weekday (Monday-Friday) nearest the given day (applies only to |
| Last weekday of the month. |
The following table demonstrates 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 p.m. | 0 | 12 | ? | * | 7 |
Twice a month on the 1st and 15th at 12 a.m. | 0 | 0 | 1,15 | * | ? |
Last Friday of every month at 10 p.m. | 0 | 22 | ? | * | 6L |
Last day of the month at 10 p.m. | 0 | 22 | L | * | ? |
Last weekday of the month at 6 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 update operation:
POST /<context>/admin/system/tasks/87b8a97828e647e8af5d634774b2b8a7/update HTTP/1.1
Host: organization.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []
title=gpCleanerTask&type=CleanGPJobs¶meters=&itemId=d68b96a1-4c39-4914-8d97-d82842a71bed&startDate=1589428800000&endDate=1589428800000&minute=0&hour=*&dayOfMonth=*&month=*&dayOfWeek=?&maxOccurences=30&f=pjson&token=m7zGSezM7znt6ZuIwr827imJxOTSDsjYujVdd7SiAQLYG1HmesG8EbSnTwCbiekEh0QwRdmeyp1hP63M60TPrdZQ2NzIg5G7qFaQh40MdiOCfh60-6oPKC2MNoqwdVDZ3srzreVZb66QofWXws8GMrKWkgP45A-2an5crKvReUo-pwvkzm68W87Q0yPJFA2Kww39UnMYNw-5qd2-Bt04VmkrqKI-lCbA-jFZY_UGzeGzNqnBGrjKuVB_q17HogMwThe following sample POST request demonstrates using the update operation on a Create task that changes the passcode value:
POST /<context>/admin/system/tasks/5f0cdc50cf36460990bb6edfe9b60e08/update HTTP/1.1
Host: organization.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []
title=backups&type=CreateBackup¶meters={"storeName": "backups","passcode": "myNewPasscode","description": "Automated Backups from Task Scheduler","name": "schedule1"}&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-JRmaTsbRDaBHTQTePMzQePhXl7KcEG9Cfkw2sa7P1W1eJSON Response example
{
"generation": 5,
"created": "Apr 21, 2021, 10:42:17 PM",
"active": true,
"ownerId": "c076e404cec9497488f008fc5b83e6fa",
"type": "GP_JOBS_CLEANER_TASK_TYPE",
"orgId": "0123456789ABCDEF",
"cronSchedule": {
"dayOfWeek": "?",
"hour": "*",
"month": "*",
"dayOfMonth": "*",
"minute": "0"
},
"cronExpression": "0 0 * * * ?",
"itemId": "0a78247d-0d0d-4b69-a658-03104e15bd66",
"runIntervalSeconds": 3600,
"taskType": "CleanGPJobs",
"taskState": "active",
"taskTitle": "gpCleanerTask",
"maxOccurrences": -1,
"id": "2a1ba86743414f929c0c1f38b32f1c9c",
"lastStart": "Apr 22, 2021, 3:00:00 AM",
"updated": "Apr 21, 2021, 10:42:17 PM",
"taskId": "2a1ba86743414f929c0c1f38b32f1c9c"
}