04 Build your first Workflows

This is a pre-release version of our certification course. It is not yet complete and is subject to change.

Now that we have the basics of working in the Design Canvas out of the way, let's move on to some practical exercises!

When you see a section titled 'exercise', this is a practical exercise that you need to follow along with.

Create a new Workflow for each exercise and name it according to the exercise number so you can easily come back to it later if you want. Follow the steps listed to build the Workflow and then run it to confirm it's working as expected.

Submit the Workflow for grading by clicking Submit Exercise, then select the exercise number that the Workflow represents. You'll receive a message letting you know whether the exercise passed.

If it didn't pass, there will be some error information explaining what was missing.

Exercise 01: Get Employee

In this exercise, we'll call a third party API that returns details of an employee given an employee id.

  1. Add a Web Request 2 Node to the Canvas.

Web Request 2 is our latest connector for making calls to third party APIs or websites.

  1. Set the Url Property to https://zorkco.flowgear.net/employees/{id}/?auth-key={auth}.

In the URL above, we're using braces to denote identifiers that will be replaced out later. The runtime will look for a Custom Property on the Node that has the same name as the identifier and translate it out before invoking the Node.

  1. Add Custom input Properties called id and token (to match the brace-encapsulated identifiers in the URL).

  2. Add a Variable Bar to the Canvas

This Variable Bar Node will contain the inputs into the Workflow. The best place to position it is just above the Start Node.

  1. Add a Custom Property for id and toggle the Flow Sockets to be outputs (i.e. the Flow Socket should be on the right-hand side of the Node). Set the value of id to 1.

  2. Add a second Custom Property for auth to the Variable Bar Node. Set this to an output Property too and then dropdown the Property Type list, changing it from Default Property to Hidden Property.

Marking a Property as hidden ensures its value isn't visible from outside of the Workflow.

  1. Set the value of the auth Property on the Variable Bar Node to zLuMd3KlJE-UsAXXh581YYz_YGrlbFXWY_0qplTAIQtrPhFg4BtmnY4fJ5cB1VdrQWN3_3Dp_wHl1muMLZaPHA to the auth Property on the Variable Bar Node.

  2. Connect the id and auth Properties on the Variable Bar Node to the id and auth Properties respectively, on the Web Request 2 Node.

  3. Connect an Execution Flow from the RunNow Output on the Start Node to the Web Request 2 Node

Run the Workflow to check it is executing successfully. If you focus the Web Request 2 Workflow Log Entry and scroll to the right, you'll see a column header for ResponseBody.

The document for employee 1 will be shown there but since it's a JSON document you'll only see the first line which is a brace character ({). Click this to view the document in a full screen modal.

We'll now add a Variable Bar to capture specific elements out of the response document.

  1. Add a second Variable Bar Node to the right of the Web Request 2 Node.

  2. Add the Custom Properties name, salary and age to the second Variable Bar Node.

  3. Drag three separate Flow Connectors from the ResponseBody Property on the Web Request 2 Node to name, salary and age on the second Variable Bar Node.

By default a Data Flow Connector will send the full Property value from the source Property to the target but you can also use Data Flow Expressions to pick a specific element out of a document.

Hover a Data Flow Connector to see the fx icon. When clicked, a tree of the known fields inside the Property will be displayed. You can select the specific field you want or capture a JSONPath expression.

If you don't see a tree view containing fields, this means no example document is available because the Node the Flow Connector connects from has not been run. Run the Workflow, ensuring that Node executes in order to have sample data display.

  1. Hover each of the Flow Connectors and click the fx icon to choose which field to pick for each Flow Connector. Select employee_name for name, employee_salary for salary and employee_age for age.