Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

...

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 with powershell.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. 
  • 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.

...