Scope

The JobScheduler comes with a powerful REST Web Service interface for access by external applications. This interface is used for tasks such as adding orders, adding events and retrieving job and order status information.

Usage

  • The REST Web Service is called by using an HTTP client.
  • The following REST Web Service requests are supported:
  • Requirements
    • All REST Web Service requests should use an HTTP POST operation.
    • Should an idle timeout of 15 minutes between two web service requests be exceeded then the current session is invalidated and a login has to be performed.

Specification

The documentation is available from https://www.sos-berlin.com/JOC/latestJS1/raml-doc/JOC-API/index.html and includes the RAML specification.

XML Commands

Find the list of XML Commands from the Reference Documentation.

The following table states the available XML commands for the JobScheduler REST Web Service, deprecated XML commands show a red background.

XML CommandDescription
<show_state/>Retrieves status information about a JobScheduler Master

<params.get/>

<param.get name="..."/>

Shows parameters from ./config/scheduler.xml
<terminate restart="yes"/>Terminates and restarts a JobScheduler Master
<modify_spooler cmd="abort_immediately_and_restart"/> Aborts and restarts a JobScheduler Master
<modify_spooler cmd="pause"/>Pauses a JobScheduler Master
<modify_spooler cmd="continue"/> Continues operation of the JobScheduler Master after pausing
<terminate/>Terminates a JobScheduler Master
<modify_spooler cmd="abort_immediately"/>Aborts a JobScheduler Master
<modify_spooler cmd="stop"/>Stops any running tasks in a JobScheduler Master
<scheduler_log.log_categories.set/>
<scheduler_log.log_categories.show/> 

<scheduler_log.log_categories.reset/>  
Activates, retrieves and resets log categories

<modify_spooler cmd="continue_exclusive_operation"/>

Terminates the active JobScheduler cluster member and activates a passive cluster member for fail-over
<terminate restart="yes" all_schedulers="yes"/>Terminates and restarts all JobScheduler cluster members
<terminate all_schedulers="yes"/>Terminates all JobScheduler cluster members
<show_history/>Retrieve the JobScheduler history
<show_order/>Retrieve order status information
<modify_order state="..." end_state="..."/>Modifies the starting and ending states of an order
<modify_order><run_time/></modify_order>Modifies the run-time of a temporary ad hoc order
<modify_order><params><param name="..." value="..."/></params></modify_order>Modifies order parameters
<modify_order><run_time/></modify_order>Modifies the run-time of a permanent order
<modify_order state="..."/>Modifies an order's state
<modify_order/>Modifies any remaining order attributes not covered by other permissions
<modify_hot_folder><order/></modify_hot_folder>Updates an order in the JobScheduler Master ./config/live directory
<modfiy_order at="now"/>Causes an immediate start of the order
<modify_order/>Updates order attributes
<modify_order suspended="yes"/>Suspends an order
<modify_order suspended="no"/>Continues a previously suspended order
<modify_order action="reset"/>Resets an order
<modify_order setback="no"/>Removes a setback setting for an order
<remove_order/>Removes a temporary ad hoc order from the JobScheduler Master
<show_job_chain/>Retrieves status information about a job chain
<job_chain.modify state="stopped"/>Stops a job chain
<job_chain.modify state="running"/>Continues a previously stopped job chain
<add_order/> Add a temporary ad hoc order to a job chain
<job_chain_node.modify action="next_state"/>Skips a job chain node
<job_chain_node.modify action="process"/>Continues processing of a job chain node that has previously been skipped or stopped
<job_chain_node.modify action="stop"/>Stops a job chain node
<modify_hot_folder><job_chain/></modify_hot_folder>Updates a job chain in the JobScheduler Master ./config/live directory
<show_job/>Retrieves status information about a job
<modify_job><run_time/></modify_job>Modifies the run-time of a job
<modify_hot_folder><job/></modify_hot_folder>Updates a job in the JobScheduler Master ./config/live directory
<start_job/>Starts a job
<modify_job cmd="stop"/>Stops a job
<modify_job cmd="unstop"/>Unstops a previously stopped job
<modify_job cmd="end"/>Terminates a job
<kill_task/>Kills a task that is running for the job
<kill_task immediately="yes" timeout="never"/>  Sends all running tasks for a job a SIGTERM signal
<modify_job cmd="suspend"/>Suspends all running tasks for a job
<modify_job cmd="continue"/>Continues all previously suspended tasks for a job
<show_state/>Retrieves status information about process classes
<process_class/>Modifies a process class
<process_class.remove/>Removes a process class
<modify_hot_folder><process_class/></modify_hot_folder>Updates a process class in the JobScheduler Master ./config/live directory
<show_state/>Retrieves status information about schedules
<modify_hot_folder><schedule substitute="..."/></modify_hot_folder>Assigns a substitute schedule to an existing schedule
<schedule.remove/>Removes a schedule
<modify_hot_folder><schedule/></modify_hot_folder>Updates a schedule in the JobScheduler Master ./config/live directory
<show_state/>Retrieves status information about locks
<lock/>Modifies a lock
<lock.remove/>Removes a lock

Examples

Example for authentication request

As the REST Web Service requires authentication therefore the first request could look like this:

HTTP Post Sample for authentication request
POST /joc/api/security/login HTTP/1.1
Host: localhost:4446
Authorization: Basic YXA6YXA=
Content-Type: application/json
Cache-Control: no-cache

Explanations

  • The JobScheduler REST Web Service (and the JOC Cockpit) are operated on the localhost with port 4446.
  • The URL in use is http://localhost:4446/joc/api/security/login
  • The Authorization header is used for HTTP Authentication, i.e. the constant value Basic and the base64 encoded user name and password separated by a colon.
  • Consider use of the Content-Type header application/json.
  • No body is required for this request.


The REST Web Service response is provided in JSON format and could look like this:

Web Service authentication response
{
  "enableTouch": true,
  "sessionTimeout": 1500000,
  "user": "ap",
  "accessToken": "c96a8563-5910-4d76-bc2a-4bc969a88d05",
  "hasRole": false,
  "isAuthenticated": true,
  "isPermitted": false
}

Explanations

  • The sessionTimeout property provides the idle timeout in milliseconds, i.e. the session will be expire should no requests be performed during the duration specified by the timeout.
  • The accessToken is a token provided by the Web Service that has to be used for authentication of subsequent requests.

Example for retrieval of status information

After successful authentication with the REST Web Service subsequently XML Commands can be sent to JobScheduler:

HTTP Post Sample for status information
POST /joc/api/jobscheduler/commands HTTP/1.1
Host: localhost:4446
X-Access-Token: c96a8563-5910-4d76-bc2a-4bc969a88d05
Content-Type: application/xml
Cache-Control: no-cache
<jobscheduler_commands jobschedulerId='scheduler111'><show_state/></jobscheduler_commands>

Explanations

  • The JobScheduler REST Web Service (and the JOC Cockpit) are operated on the localhost with port 4446.
  • The URL in use is http://localhost:4446/joc/api/jobscheduler/commands
  • The value for the access_token has been retrieved from a previous authentication request.
  • Consider use of the Content-Type header application/xml.
  • The body contains the effective XML commands wrapped in a <jobscheduler_commands jobschedulerId="..."/> element where jobschedulerId is the JobScheduler ID of the respective JobScheduler Master.

Example for adding an order

Adding a temporary ad hoc order to JobScheduler could look like this:

HTTP Post Sample for adding an order to a job chain
POST /joc/api/jobscheduler/commands HTTP/1.1
Host: localhost:4446
X-Access-Token: ce31fb8f-9f5a-4e3e-805d-72c71d0547ce
Content-Type: application/xml
Cache-Control: no-cache
Postman-Token: 88bd687a-586d-fd93-d203-bcd7e71a6a85
<jobscheduler_commands jobschedulerId='scheduler111'><add_order job_chain="/some_folder/some_chain"><params><param name="first" value="1st"/><params name="second" value="2nd"/></params></add_order></jobscheduler_commands>

Explanations

  • The JobScheduler REST Web Service (and the JOC Cockpit) are operated on the localhost with port 4446.
  • The URL in use is http://localhost:4446/joc/api/jobscheduler/commands
  • The value for the access_token has been retrieved from a previous authentication request.
  • Consider use of the Content-Type header application/xml.
  • The body contains the effective XML commands wrapped in a <jobscheduler_commands jobschedulerId="..."/> element where jobschedulerId is the JobScheduler ID of the respective JobScheduler Master. The effective XML Command <add_order/> is used to to add a temporary order to a job chain and optionally to add parameters to the order.

References

Change Management References

T Key Linked Issues Fix Version/s Status P Summary Updated
Loading...
Refresh

Documentation


  • No labels