
This resource address is used to create a new scheduled task for the specified group. For an example, see Creating a Push Replication Scheduled Task in the Scripting Administrative Tasks Guide.
Upon success, MarkLogic Server returns status code 201 (Created). If the task exists or if the payload is malformed, a status code of 400 (Bad Request) is returned. A status code of 401 (Unauthorized) is returned if the user does not have the necessary privileges.
manage-admin and securityrolehttp://marklogic.com/xdmp/privileges/manage-admin
http://marklogic.com/xdmp/privileges/manage
http://marklogic.com/xdmp/privileges/switch-task-user
manage role plus one of the following granular privileges:
http://marklogic.com/xdmp/privileges/admin/grouphttp://marklogic.com/xdmp/privileges/admin/group/{group-ID}http://marklogic.com/xdmp/privileges/admin/group/scheduled-taskhttp://marklogic.com/xdmp/privileges/admin/group/scheduled-task/{group-ID}http://marklogic.com/xdmp/privileges/switch-task-userThe security role is required to set the task-user property.
task-database property. The task-start-time property
must be in xs:time format ("24:00"). The task-type property is
(minutely|hourly
|daily|weekly|monthly|once). If not
supplied, the default value is once. The task-days property is an
array containing (sunday, monday, tuesday,
wednesday, thursday, friday, saturday).
The task-priority property is (normal|higher), if not
supplied, default value is normal. Note: The properties described here are
for XML payloads. In general they are the same for JSON, with the exception that, in JSON,
task-days is expressed in singular form. For example, in JSON,
task-days is instead task-day and the format is as shown in the
following example.
task-idtask-enabledtask-pathtask-roottask-typetask-periodtask-month-daytask-daysThis is a complex structure with the following children:
task-daytask-start-datetask-start-timetask-timestamptask-databasetask-modulestask-usertask-hosttask-priority
cat myTask.json
==>
{
"task-enabled":true,
"task-path":"/path/to/query.xqy",
"task-root":"/",
"task-type":"weekly",
"task-period":2,
"task-day":["tuesday"],
"task-start-time":"12:00:00-08:00",
"task-timestamp":"2014-11-24T14:23:51.468616-08:00",
"task-database":"Documents",
"task-modules":"",
"task-user":"nobody"
}
curl -X POST --digest -u admin:admin -H "Content-type: application/json" \
-d @myTask.json http://localhost:8002/manage/v2/tasks?group-id=Default
==> Creates a task in the Default group to run "/path/to/query.xqy" on Tuesday
every other week at 12:00.