Introduction
- Any operations that can be performed on orders, workflows, jobs and related objects such as cancelling, suspending and resuming orders are performed by the JS7 - REST Web Service API.
- Note that any operation available with the JOC Cockpit GUI makes use of the REST Web Service API.
- For detailed information see the Technical Documentation of the REST Web Service API.
- In addition, a PowerShell module is available for simplified access to the REST Web Service API. This is described in the JS7 - PowerShell Module article.
- The REST Web Service API can also be accessed from Python .
Usage
- The REST Web Service API is called by using a HTTP client that sends JSON based requests and receives JSON based responses.
- The following REST Web Service API requests are available:
- URL
joc/api/authentication/login
- The first operation a client carries out is a 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. For HTTPS connections in addition or alternatively JS7 - Certificate based Authentication can apply - for details see the JS7 - Identity and Access Management article.
- Permissions apply as explained in the JS7 - Management of User Accounts, Roles and Permissions article.
- URL
joc/api/*
- Subsequent calls to URLs can, for example, retrieve the inventory of workflow.
- The relevant URLs can be found in the Technical Documentation of the REST Web Service API
- The JS7 REST Web Service API returns the relevant JSON response as indicated in the docs.
- URL
joc/api/authentication/logout
- The last operation a client carries out is a call to this URL in order to logout from the REST Web Service API.
- URL
- Requirements
- REST Web Service API requests should use HTTP POST operations as indicated.
- Should the idle timeout between two web service requests exceed the JOC Cockpit session timeout then a login has to be performed, see the JS7 - Settings article for more information.
Example for Python
- Example: Create a workflow with a single job in the JS7 inventory and deploy the workflow.
- The attached example js7_api_sample.py is for use with Python3. We do not consider this a perfect example for handling web service requests. However, it shows the building blocks:
Explanations
- Line 7-10: 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 11-12: Default credentials after installation include the account "root" and password "root". The credentials might have been changed after setup of the JOC Cockpit. There are alternative ways for secure management of credentials when using the JS7 REST Web Service API.
- Line 57-58: The request to the /authentication/login web service returns an access token which is used with further requests.
- Line 60: The Controller ID is specified during installation of the Controller and identifies a Controller standalone instance or a Controller cluster. The workflow will be deployed to the indicated Controller.
- Line 61: Specifies the path to the workflow in the JS7 inventory. Any folders included with the path are automatically created.
- Line 62-90: The workflow is created from a here-string. There are better programmatic ways how to do this.
- Line 93: The workflow is stored to the JS7 inventory. With this operation being completed the workflow is visible from the JOC Cockpit user interface.
- Line 95: The workflow is deployed to the indicated Controller.
- Line 97: Always perform a logout and consider the session idle timeout.
- The attached example js7_api_sample.py is for use with Python3. We do not consider this a perfect example for handling web service requests. However, it shows the building blocks:
Overview
Content Tools