Use the Scheduler API to define a schedule for system activities and manage the jobs that result from the schedule.
This API is deprecated in favor of the Jobs API.
For more information, view the API specification. All of the Fusion services are available for scheduling, as are any Solr activities and any other HTTP-based URI. See Jobs and Schedules for more information about all of the options available for scheduling, and instructions for configuring scheduler jobs using the Fusion UI.

Schedule Definition Properties

ParameterDescription
active
Optional
If true, the schedule will be executed according to the defined interval. If false, the schedule will be disabled and will not run at the defined time.
callParams
Required
The callParams define the API call to execute at the defined time intervals. It allows several properties:
uri. a fully-qualified service URI. This can be an HTTP call, a Solr request, or a Managed Fusion service call.
Supported URI schemas are: http://, https://, solr://{collection}/…​, or service://{serviceName}/{path}.
method. The method to use, as in GET, POST, PUT, or DELETE.
queryParams. Query parameters to be passed with the request. For Solr calls, this could be parameters such as “q”, “fq”, “commit”, etc.
headers. Any additional protocol headers, such as “Content-type”.
entity. An optional payload to be sent with the request.
creatorId
Optional
An ID for the user that created the schedule.
creatorType
Optional
The type of user that created the schedule. If you have resources creating schedules programmatically, you could define a type that helps distinguish those schedules from others created by people.
endTime
Optional
A time when the schedule should be terminated, i.e., when it will not run any more in the future. If not set, the schedule will run until it is disabled (i.e., “active” is set to false) or deleted.
id
Required
The ID of the schedule. This is required when creating a schedule with a POST request.
interval
Optional
An integer that when combined with the repeatUnit property defines how often the schedule will run. If this is not set, or set to a number lower than ‘1’ (i.e., ‘0’), the schedule will only be run once.
repeatUnit
Optional
A unit of time that when combined with the interval property defines how often the schedule will run. Allowed values are:
● “millisecond” or “ms”
● “second” or “sec”
● “minute” or “min”
● “hour” or “hr”
● “day”
● “week”
● “month” These time units are not case sensitive.
startTime
Optional
A time when the schedule should be started. If this is not set, it will be set to the date/time when the schedule was created.

Examples

Run a crawl of the datasource “LocalDocs2” every day: REQUEST
curl -u USERNAME:PASSWORD -X POST -H 'Content-Type: application/json' -d '{"id":"1", "creatorType":"human", "creatorId":"admin1", "repeatUnit":"DAY", "interval":1, "active":true, "callParams":{"uri":"service://connectors/jobs/LocalDocs2", "method":"POST"}}' https://FUSION_HOST:FUSION_PORT/api/scheduler/schedules
Response
{
  "id" : "1",
  "trigger" : "1_1400007488512_-9223372036854775808",
  "schedule" : {
    "id" : "1",
    "creatorType" : "human",
    "creatorId" : "admin1",
    "createTime" : "2014-05-13T18:58:08.512Z",
    "startTime" : "2014-05-13T18:58:08.512Z",
    "endTime" : null,
    "repeatUnit" : "DAY",
    "interval" : 1,
    "active" : true,
    "callParams" : {
      "uri" : "service://connectors/jobs/LocalDocs2",
      "method" : "POST",
      "queryParams" : { },
      "headers" : { },
      "entity" : null
    }
  }
}
Issue a commit to the SolrCloud collection “demo” every hour: REQUEST
curl-u USERNAME:PASSWORD -X POST -H 'Content-Type: application/json' -d '{"id":"2", "creatorType":"human", "creatorId":"admin1", "repeatUnit":"HOUR", "interval":1, "active":true, "callParams":{"uri":"solr://demo/update", "method":"GET", "queryParams":{"stream.body":"<commit/>"}}}' https://FUSION_HOST:FUSION_PORT/api/scheduler/schedules
Response
{
  "id" : "2",
  "trigger" : "2_1400011854443_-9223372036854775807",
  "schedule" : {
    "id" : "2",
    "creatorType" : "human",
    "creatorId" : "admin1",
    "createTime" : "2014-05-13T20:10:54.443Z",
    "startTime" : "2014-05-13T20:10:54.443Z",
    "endTime" : null,
    "repeatUnit" : "HOUR",
    "interval" : 1,
    "active" : true,
    "callParams" : {
      "uri" : "solr://demo/update",
      "method" : "GET",
      "queryParams" : {
        "stream.body" : "<commit/>"
      },
      "headers" : { },
      "entity" : null
    }
  }
}
Set schedule “2” to inactive: REQUEST
curl -u USERNAME:PASSWORD -X PUT -H 'Content-Type: application/json' -d '{"creatorType":"human", "creatorId":"admin1", "repeatUnit":"HOUR", "interval":1, "active":false, "callParams":{"uri":"solr://demo/update", "method":"GET", "queryParams":{"stream.body":"<commit/>"}}}' https://FUSION_HOST:FUSION_PORT/api/scheduler/schedules/2
There will be no response if the PUT request was successful. List all scheduled jobs: REQUEST
 curl -u USERNAME:PASSWORD https://FUSION_HOST:FUSION_PORT/api/scheduler/jobs
Response
[ {
  "id" : "2",
  "trigger" : "2_1400011854443_-9223372036854775807",
  "schedule" : {
    "id" : "2",
    "creatorType" : "human",
    "creatorId" : "admin1",
    "createTime" : "2014-05-13T20:10:54.443Z",
    "startTime" : "2014-05-13T20:10:54.443Z",
    "endTime" : null,
    "repeatUnit" : "HOUR",
    "interval" : 1,
    "active" : true,
    "callParams" : {
      "uri" : "solr://demo/update",
      "method" : "GET",
      "queryParams" : {
        "stream.body" : "<commit/>"
      },
      "headers" : { },
      "entity" : null
    }
  }
}, {
  "id" : "1",
  "trigger" : "1_1400007488512_-9223372036854775808",
  "schedule" : {
    "id" : "1",
    "creatorType" : "human",
    "creatorId" : "admin1",
    "createTime" : "2014-05-13T18:58:08.512Z",
    "startTime" : "2014-05-13T18:58:08.512Z",
    "endTime" : null,
    "repeatUnit" : "DAY",
    "interval" : 1,
    "active" : true,
    "callParams" : {
      "uri" : "service://connectors/jobs/LocalDocs2",
      "method" : "POST",
      "queryParams" : { },
      "headers" : { },
      "entity" : null
    }
  }
} ]
List the history of job ID ‘1’: REQUEST
curl -u USERNAME:PASSWORD https://FUSION_HOST:FUSION_PORT/api/history/scheduler/items/1
Response
{
 "events" : [ {
 "start" : "2014-05-16T15:34:49.008Z",
 "end" : "2014-05-16T15:34:49.435Z",
 "source" : "scheduler",
 "type" : "execute",
 "status" : "ok",
 "details" : {
 "status" : 200,
 "entity" : "{\n \"id\" : \"TwitterSearch\",\n \"dataSourceId\" : \"TwitterSearch\",\n \"state\" : \"RUNNING\",\n \"message\" : null,\n \"startTime\" : 1400254489000,\n \"endTime\" : -1,\n \"finished\" : false,\n \"counters\" : { },\n \"exception\" : null,\n \"running\" : true\n}"
 },
 "error" : null
 }, {
 "start" : "2014-05-16T15:38:32.536Z",
 "end" : "2014-05-16T15:38:32.559Z",
 "source" : "scheduler",
 "type" : "execute",
 "status" : "ok",
 "details" : {
 "status" : 200,
 "entity" : "{\n \"id\" : \"TwitterSearch\",\n \"dataSourceId\" : \"TwitterSearch\",\n \"state\" : \"RUNNING\",\n \"message\" : null,\n \"startTime\" : 1400254712000,\n \"endTime\" : -1,\n \"finished\" : false,\n \"counters\" : { },\n \"exception\" : null,\n \"running\" : true\n}"
 } ]
}