Scope
The JOC Cockpit comes with a REST Web Service interface for JSON. This interface is used for access to the job inventory and the job history as well as individual objects such as jobs, job chains and orders and provides current status information.
- The JOC Cockpit REST Web Service provides the API for the JOC Cockpit user interface.
- The API might change along minor releases with the requirements of future JOC Cockpit development.
- The JOC Cockpit REST Web Service comes in addition to the JobScheduler - REST Web Service that is considered as a replacement for the retired XML Interface.
- The REST Web Service is used by the JOC Cockpit for interaction with a JobScheduler Master:
- Access to the REST Web Service is restricted by permissions, see Authentication and Authorization - Permissions for the JOC Cockpit Web Service
Usage
- The REST Web Service is called by using an HTTP client that sends JSON based requests and that receives JSON based responses.
- The following REST Web Service requests are supported:
- URL
joc/api/security/login
- The first operation of a client should be call to this URL in order to authenticate and to retrieve an access token.
- A valid account and password have to be provided by the client for HTTP authentication. The account and permissions for the command(s) to be executed are configured with the
shiro.ini
configuration file. See the Authentication and Authorization - Configuration article and the exampleapi_user
configuration for further information. - Use the
joc/api/security/joc_cockpit_permissions
URL to retrieve the permissions for the current user.
- URL
joc/api/*
- Subsequent calls to URLs can retrieve the job inventory and current information about jobs and job chains.
- The JOC Cockpit REST Web Service will return the respective JSON response.
- URL
joc/api/security/logout
- The last operation of a client should be a call to this URL in order to logout from the web service.
- URL
- Requirements
- REST Web Service requests should use HTTP POST or GET operations as indicated.
- 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.
- Example
- Find attached example joc_cockpit_curl_sample.sh for use with curl. We do not consider curl to be perfectly prepared to handle web service requests, however, it shows the building blocks:
- Line 7: Depending on your JOC Cockpit installation the protocol will be http or https. The default port is 4446 but might have been modified during setup.
- Line 10: The JobScheduler ID is specified during installation of the Master and identifies a Master standalone instance or a Master cluster.
- Line 19, 20: Default credentials after installation include the account "root" and password "root". The credentials might have been changed after setup of JOC Cockpit.
- Lin 27: Consider to use Basic HTTP authentication
- Line 28: The request to the /security/login web service returns an access token that is used with further requests.
- Line 36, 39: Suspending an order includes to specify with the request body the JobSchedulerID, the order id and the full path of the job chain.
- Line 47: Always perform a logout and consider the session idle timeout.
- Find attached example joc_cockpit_curl_sample.sh for use with curl. We do not consider curl to be perfectly prepared to handle web service requests, however, it shows the building blocks:
Specification
- The specification is available from JOC Cockpit REST Web Services Technical Documentation (RAML Specification).
References
- Authentication and Authorization: Permissions for the JOC Cockpit Web Service
- Specification JOC Cockpit REST Web Services Technical Documentation (RAML Specification)