- URL:
- https://[root]/community/users/[userName]/tasks/createTask
- Methods:
POST- Version Introduced:
- ArcGIS Enterprise 10.8.1
Example usage
The following is a sample ArcGIS Online POST request for the create operation, demonstrating how to create a task for a scene service:
POST /sharing/rest/community/users/NBadmin/tasks/a7ce628005004e758f3387d735b3e1ca/createTask HTTP/1.1
Host: org.arcgis.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []
title=OnceAnHour30Times&type=ExecuteSceneCook¶meters={"service_url": "https://organization.esri.com/<context>/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=?&maxOccurrences=30&f=pjsonThe following is a sample ArcGIS Enterprise POST request for the create operation, demonstrating how to create a task for a scene service:
POST /<context>/sharing/rest/community/users/NBadmin/tasks/a7ce628005004e758f3387d735b3e1ca/createTask HTTP/1.1
Host: organization.example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: []
title=OnceAnHour30Times&type=ExecuteSceneCook¶meters={"service_url": "https://organization.example.com/<context>/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=?&maxOccurrences=30&f=pjsonDescription
The create operation creates a scheduled task for a number of supported task types. Once the task has been created, it can be updated using the update operation. Additionally, scheduled tasks can be disabled, re-enabled, and deleted.
Request parameters
| Parameter | Details |
|---|---|
(Optional) | Title of the task. Example: |
(Required) | The type of task that will be run on the specified item. The following are the tasks this operation supports:
Values: |
(Optional; required for geoprocessing service) | The URL of the task of an asynchronous geoprocessing service on any of the federated servers of your portal. Example: |
(Optional; required for some | A JSON object of additional parameters that will be added to the task run request. This parameter is required for scene services, administrative reports, geoprocessing services, and backups. Syntax example for a scene service (formatted for readability): Syntax example for creating a backup: Scene service example: Backup example: Administrative reports example: Geoprocessing service example (formatted for readability): |
(Required; optional for administrative reports) | Item ID of the item the scheduled task will be run on. Example: |
(Optional) | A Unix timestamp in milliseconds representing the date the schedule task will begin running. Example: |
(Optional) | A Unix timestamp in milliseconds representing the date the schedule 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 ( Examples: |
(Required) | A valid CRON expression ( Example: |
(Optional) | The maximum number of times this task will run. Example: |
| The response format. The default format is Values: |
Additional example usage 1
The following is a sample ArcGIS Enterprise POST request for create, demonstrating creating a task for a geoprocessing service:
This specific example is scheduling a pairwise buffer geoprocessing service with an overwritten output feature service. You can have a customized boundary for your request. You need to provide a valid administrator token.
POST /<context>/sharing/rest/community/users/GPadmin/createTask HTTP/2
Host: organization.example.com
Content-Type: multipart/form-data; boundary=---------------------------4137116237415213046158097313
Content-Length: 2490
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="title"
TestGPServiceTask
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="type"
GPService
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="taskURL"
https://organization.example.com/<context>/rest/services/Level1_Async/GPServer/Pairwise%20Buffer
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="parameters"
{
"in_features": {
"url": "https://organization.example.com/<context>/rest/services/Hosted/ServiceName/FeatureServer/0"
},
"buffer_distance_or_field": {
"distance": 5,
"units": "esriKilometers"
},
"esri_out_feature_service_name": {
"serviceProperties": {
"serviceUrl": "https://organization.example.com/<context>/rest/services/Hosted/OutputFeatureServiceName/FeatureServer"
},
"itemProperties": {
"overwrite": true,
"newFeatureServiceOnOverwriteFail": true
}
}
}
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="itemId"
9512500fb1ac443baf943f418400b661
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="startDate"
1691451979521
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="endDate"
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="minute"
*/10
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="hour"
*
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="dayOfMonth"
*
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="month"
*
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="dayOfWeek"
?
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="maxOccurrences"
5
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="f"
json
-----------------------------4137116237415213046158097313
Content-Disposition: form-data; name="token"
j18phrBxUy4tX_JAIGFEDqCsVkNsPZfwt-1X2ehnRqcihHaJ54Lbt97Y6pOn83jD6ytI8x9tMkqod3uQ6HYqvIqwUTEdKkkNQiEM2S_ehwGuUuIiQkmKbo6KdnUeuVqKmxaWdAXCy2nftfxKhW47rd_jAccwT8bQyls5p8f14Nts5I5_4fS2URnQ70H5W83O
-----------------------------4137116237415213046158097313--JSON Response example
{
"success": true,
"taskId": "ddea837537ef435c9496c5fc22799973"
}