Blog

Test System flow during Development by Indicium API

  • 6 October 2021
  • 2 replies
  • 417 views
Test System flow during Development by Indicium API
Userlevel 7
Badge +23

Hi everyone!,

Often we hear developers wanting to test their system flows but not knowing what is an effective and quick way of doing so. This blog will help you out!

To test System flows, we can make use of Indicium's Process flow API as described here: https://docs.thinkwisesoftware.com/docs/indicium/process_flows.html

Since Indicium requires a POST request, some extra tooling is needed to send such a request. We commonly use either Insomnia or Postman, but alternatives are available online. For this blog, I'll use Insomnia.

Creating a System flow

Start of making or determining a system flow you would want to test.

System flow

For my example, I kept it very simple. The Decision process action will run a process procedure to create a new record to the system_flow_table in my database.

Design
Control procedure

Using Insomnia

Insomnia is a powerful app what can do a lot, but for this example we'll create a new POST request.

Start off by right clicking in the left panel (or use the shortcut Ctrl+N to make a New request):

New request (1/2)

Fill in a name, for example the system flow's name and select POST from the dropdown menu. Like specified in the Docs, no body is needed:

New request (2/2)

For the request URL, form the URL as follows:

https://[servername]/[indicium]/sf/[gui_appl_id]/[system_flow]

Replace the parts with brackets with the correct values. My personal example request is shown later on. The gui_appl_id is the Application id of the Runtime configuration, you can also use an Application alias for it instead. Simply replace the [gui_appl_id] part with the Application alias.

A process flow can be started by sending a POST request without a body to the process flow's endpoint

Make sure you authenticate your request as you'll need to have authorization to do this request. Select Basic auth from the dropdown menu. Using Basic authentication is sufficient.

Basic authentication

You now are set to fire away the request to Indicium. Press Send to send the request.

If you see the HTTP status code 204, that means your System flow has run successfully!:

204 (No Content) = Successful

The result after the system flow execution:

Record is created

This is a quick way of testing out your created System flows. Be aware that system flows can fail and this method of testing does not give a good debugging result by itself. You can consult the Indicium log to see if anything went wrong during testing. And in addition to that, adding debug lines of code to your process procedures to find out and make sure the system flow runs as intended.


2 replies

Userlevel 3
Badge +11

Hi Mark,

 

I tested this and after creating a system flow and calling the url I received following message:

 

Cannot start process flow 'test_api' on this endpoint, because it's configured as a message protocol independent process flow in the Software Factory. Try the /open/sf/cf_web_dev/test endpoint instead.

That was helpfull and the flow did run when I changed the url. But can you explain the message and the need/cause for the addition /open/ in the url?

 

Hugo

Userlevel 7
Badge +23

Hi Mark,

 

I tested this and after creating a system flow and calling the url I received following message:

 

Cannot start process flow 'test_api' on this endpoint, because it's configured as a message protocol independent process flow in the Software Factory. Try the /open/sf/cf_web_dev/test endpoint instead.

That was helpfull and the flow did run when I changed the url. But can you explain the message and the need/cause for the addition /open/ in the url?

 

Hugo

Hi Hugo,

According to the Docs, Indicium will create a special endpoint for this process flow to be called: Process flows | Thinkwise Documentation (thinkwisesoftware.com)

The first segment of the endpoint is /open because it is a special endpoint, entirely separate from Indicium's regular OData endpoints.

Reply