Page History
Table of Contents |
---|
Introduction
A number of users wish Users may require to create workflows and jobs automatically from individual sources such as a database.
- The JS7 - REST Web Service API allows to perform the same operations to store and to deploy workflows as offered deploy workflow operations to be performed as can be carried out from the JOC Cockpit GUI.
- The JS7 - PowerShell Module offers provides simplified access to the REST Web Service API for scripting purposes.
- The PowerShell examples when executed might prove to be instructive for logging of REST API calls when executed and used with the
-debug
option.
- The PowerShell examples when executed might prove to be instructive for logging of REST API calls when executed and used with the
...
- Create the JSON representation of a workflow that includes a number of jobs.
- We suggest to first create creating the sample workflow with the JOC Cockpit and to use then either using the Show JSON workflow action menu item of the workflow to display the JSON format or to use using the download button.
- Find the JSON Schema for workflows from in the JS7 - Inventory Storage Format article.
Add the REST Web Service API calls in your preferred language or use the PowerShell cmdlets:
REST API PowerShell cmdlet Explanation /authentication/login Connect-JS7 connect to JOC Cockpit
/inventory/store Set-JS7InventoryItem store the workflow to the inventory
/inventory/deployment/deploy Publish-JS7DeployableItem deploy the workflow
/authentication/logout Disconnect-JS7 disconnect from JOC Cockpit
Example
The following example makes use uses of four lines of code to connect to JS7 , and to store and to deploy a workflow. The remaining code is used to create the workflow.
...
- Line 1: A shebang is used to invoke PowerShell on Unix platforms. For Windows platforms replace this line with:
@@findstr
/v
"^@@f.*&"
"%~f0"
|pwsh.exe -&goto:eof
- Optionally adjust modify
pwsh.exe
by withpowershell.exe
or similar to locate the PowerShell interpreter.
- Line 5: The URL to JOC Cockpit is specified. This is the same URL as used from a user browser to access JOC Cockpit.
- Line 6: The Controller ID is specified during setup of a Controller. Find the Controller ID in the upper right upper -hand corner of any JOC Cockpit page.
- Line 7.8: The name of the workflow to be crated and its full path.
- Line 12-14: Load the PowerShell Module and connect.
- For details see JS7 - How to connect to JOC Cockpit using the PowerShell Module.
- Line 18-74: The code creates the PowerShell object of a workflow that is converted to JSON. There are many ways how to do it this and different approaches as - e.g. use of template files.
- Line 78: The workflow object is stored to JS7.
- Line 79: The workflow is deployed.
- Line: 83: The connection to JOC Cockpit is closed.
...
Overview
Content Tools