Skip To Content
ArcGIS Developers
Dashboard

/createTask: Create New Scheduled Task

  • URL:https://[root]/community/users/[userName]/tasks/createTask(POST only)
  • Version Introduced:10.8.1

Example usage

POST /webadaptor/sharing/rest/community/users/NBadmin/tasks/a7ce628005004e758f3387d735b3e1ca/createTask HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

title=OnceAMinute30Times&type=ExecuteNotebook&parameters=&itemId=029b61ca770e428d9468a2a55f40b9fb&startDate=1589428800000&endDate=1589428800000&minute=*/1&hour=*&dayOfMonth=*&month=*&dayOfWeek=?&maxOccurences=30&f=pjson

Description

This operation creates a new scheduled task for a specified Notebook Server, Insights workbook, Scene Services, and ArcGIS Workflow Manager. Once the task has been created, it can be updated using the Edit Task operation. As well, scheduled tasks can be disabled, reenabled, and deleted through other operations in the Sharing API.

Note:

Support for Scene Services and ArcGIS Workflow Manager was added at ArcGIS Enterprise 10.9.

Request parameters

ParameterDetails
title

(Optional)

Title of the task.

Example

title=OnceAMinute30Times
type

(Required)

The type of task, either executing a notebook or updating an Insights workbook, that will be executed against the specified item.

Note:

Support for Scene Services and ArcGIS Workflow Manager was added at ArcGIS Enterprise 10.9.

Values: ExecuteNotebook | UpdateInsightsWorkbook | ExecuteSceneCook | ExecuteWorkflowManager

parameters

(Optional; Required for scene services)

A JSON object of additional parameters that will be added to the task run request. This parameter is required for scene services.

Syntax example for scene service (formatted for readability)

{
  "service_url": <scene service URL>,
  "num_of_caching_service_instances": 2, //2 instances are required
  "layer": "{<list of scene layers to cook>}", //The default is all layers
  "update_mode": "PARTIAL_UPDATE_NODES" //RECREATE_ALL_NODES (Re-cook full scene cash) | PARTIAL_UPDATE_NODES (Update scene cache from latest edits to the scene service) | PARTIAL_UPDATE_ATTRIBUTES (Update only attributes and not geometries) 
}

Scene service example

parameters={"service_url": https://machine.esri.com/wedadaptor/rest/services/Hosted/ServiceName/SceneServer, "num_of_caching_service_instances": 2, "layer": "{}", "update_mode":"PARTIAL_UPDATE_NODES"}
itemId

(Required)

Item ID of the item the scheduled task will be run against

itemID=029b61ca770e428d9468a2a55f40b9fb
startDate

(Optional)

Defines the date, in Epoch miliseconds, of when the scheduled task should begin running.

Example

startDate=1589428800000
endDate

(Optional)

Defines the date, in Epoch miliseconds, fo when the scheduled task should stop running.

Example

endDate=1589428800000
minute

(Required)

A valid CRON expression (, - * /) that specifies the minute value for the task's schedule.

Example

minute=*/1
hour

(Required)

A valid CRON expression (, - * /) that specifies the hour value for the task's schedule.

Example

hour=*
dayOfMonth

(Required)

A valid CRON expression (, - * ? / L W C) that specifies the day of the month for the task's schedule.

Example

dayOfMonth=*
month

(Required)

A valid CRON expression (, - * /) that specifies the month for the task's schedule.

Example

month=*
dayOfWeek

(Required)

A valid CRON expression (, - * ? / L C #) that specifies the day of the week for the task's schedule.

Example

dayOfWeek=?
maxOccurences

(Optional)

The maximum number of occurrences this task should execute.

Example

maxOccurences=30
f

The response format. The default format is html.

Values: html | json | pjson

Examples

Below is a sample POST request for createTask for ArcGIS Notebook:

POST /webadaptor/sharing/rest/community/users/NBadmin/tasks/a7ce628005004e758f3387d735b3e1ca/createTask HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

title=OnceAMinute30Times&type=ExecuteNotebook&parameters=&itemId=029b61ca770e428d9468a2a55f40b9fb&startDate=1589428800000&endDate=1589428800000&minute=*/1&hour=*&dayOfMonth=*&month=*&dayOfWeek=?&maxOccurences=30&f=pjson

Below is a sample POST request for createTask for Scene Service:

POST /webadaptor/sharing/rest/community/users/NBadmin/tasks/a7ce628005004e758f3387d735b3e1ca/createTask HTTP/1.1
Host: machine.domain.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []

title=OnceAnHour30Times&type=ExecuteSceneCook&parameters={"service_url": "https://machine.esri.com/webadaptor/rest/services/Hosted/ServiceName/SceneServer", "num_of_caching_service_instances": 2, "layer": "{}", "update_mode": "PARTIAL_UPDATE_NODES"}&itemId=029b61ca770e428d9468a2a55f40b9fb&startDate=1589428800000&endDate=1589428800000&minute=*/1&hour=*&dayOfMonth=*&month=*&dayOfWeek=?&maxOccurences=30&f=pjson

JSON Response example

{
  "success": true,
  "taskId": "ddea837537ef435c9496c5fc22799973"
}