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
role, or the following
privilege: http://marklogic.com/xdmp/privileges/manage-admin
The 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-id
task-enabled
task-path
task-root
task-type
task-period
task-month-day
task-days
This is a complex structure with the following children:
task-day
task-start-date
task-start-time
task-timestamp
task-database
task-modules
task-user
task-host
task-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 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.