Configuring the Workflow REST API
Use the Workflow REST API to manage workflows, workflow instances, events, and tasks in custom ASP.NET pages, custom apps, and third party tools, such as Microsoft Power Automate.
The page shows the configuration options once the API is enabled.
- See How To: Configure and use the "Wait for External System" option in a workflow for an example of using the workflow REST API to communicate with K2 when you use the Wait for external system option in a SmartObject workflow step.
- See How to: Use Microsoft Power Automate to start a workflow when a SharePoint list item is created for an example of using Microsoft Power Automate to start a K2 workflow from a Microsoft SharePoint action.
- See How to: Use Microsoft Power Automate to start a workflow when an email arrives in a folder in Outlook for an example of using Microsoft Outlook action in Microsoft Power Automate to start a K2 workflow when an email arrives.
- See How to: Use Microsoft Power Automate to redirect a K2 task for an example of using Microsoft Power Automate to redirect a K2 workflow task.
- See How To: Send a Message from a K2 Workflow to Microsoft Power Automate for an example of sending information from a K2 workflow to Microsoft Power Automate, use that information in a flow, and then return to continue your workflow.
You must turn on the Workflow API feature before using the service. Click the Slider to activate the Workflow REST API preview.
Select the Workflow REST API version to use on your system. Selecting the version changes the value of the Workflow API URLs, all other settings apply globally to all versions of the endpoint. This provides backward compatibility for any 3rd party solutions developed using earlier versions of the API. The version is reflected in the Swagger URL and Base URL.
The Swagger file describes the Workflow REST endpoints to third party software, such as Microsoft Power Automate. Click on Copy to copy the Swagger file URL address to your clipboard.
Click on Open Link to open the K2 Workflow Api swagger page and access the list of operations, tasks, and workflow functions.
Click on Download to open a new web page displaying the JSON swagger file. Then use File - Save As from your browser to save the descriptor file. You can now use the descriptor file in a third party application, like Microsoft Power Automate.
Swagger Page
Use the swagger page to test, use, or familiarize yourself with the endpoint functions.
You can use the Try it out! button on the swagger page to get a JSON response from the web service. For example, the Get Workflows GET function will return the number of workflows on the K2 server, and give the id, defaultVersionID, name, folder, and systemName values for each workflow.
A POST swagger function may require parameters and instance data. For example, the Start Workfow POST function needs the workflow id number. Body values can be entered; use the Example Value JSON examples to guide your construction, or use empty brackets {} to enter no data. Add Data fields, XML fields, and Item References where needed. A full schema of a workflow is available from the GET workflows/{id} function. The GET workflows/{id}/schema function provides JSON schema formatted as a string ready for Microsoft Power Automate.
The Base URL contains the K2 server address followed by the API path and version, such as https://k2.denallix.com/api/workflow/v1. Click on the Copy "@" icon to copy the Workflow REST API endpoint URL.
Add domains to the CORS list to enable those Apps or Web services to use the Workflow REST API calls.
Click on the plus icon to add a new domain. Select a domain and click on the trash can to delete it. Click on the refresh icon to reload the list of allowed domains.
When adding and removing URLs from the CORS list, you must click the Apply Changes button for the changes to take effect.
- If you leave the page without clicking Apply Changes, the changes will be lost.
- If you click on the Refresh icon before clicking Apply Changes, a warning popup display
- If you click ok, the changes (addition or removal) will be lost.
- If you click cancel, the pop up will close and nothing will happen.
The service uses Basic and OAuth Authentication.
You must use a custom connector when using OAuth for authentication.
For more information see Authentication with the Workflow REST API.