App Connect

 View Only

Gain confidence in your flows while authoring with the new “Try this flow” feature in IBM App Connect

By Sarah Hewitt posted Tue August 18, 2020 11:13 AM

  

In the latest release of IBM® App Connect, you can try out an entire flow containing multiple actions by using your specified mappings and sample data values. Along with the existing “test action” feature (introduced in the Rapidly develop your flows with the new test action feature in IBM App Connect blog), this new feature allows you to have confidence that the flow you are developing will behave exactly as you expect.

The following restrictions apply for this new capability:

  • Flows that contain Batch process, Notification, or Situation detector nodes cannot be tested.
  • A For each node will process only the first three items that it receives.

To try your flow, you must ensure that:

  • All node definitions in the flow are valid and the flow can be started.
  • The flow is not currently running.

This release also now enables you to specify values for the input to your flows by opening the “Context and sample data” pane from an event node in an event-driven flow, or the Request node in a flow for an API. You can specify your own values as sample data for any available mapping or automatically generate sample values by using the new Regenerate sample data button. Any changes to the sample data will persist for as long as the flow is open.

The Context and sample data pane showing the Regenerate sample data button
Fig 1. The “Context and sample data” pane showing the “Regenerate sample data” button and sample data values that have been generated. The “Try this flow” icon can be seen next to the flow name.

 

Scenario: Using the “Try this flow” feature to develop an API flow to retrieve Eventbrite event details

In this example, we are going to develop an API flow that queries the events in a connected Eventbrite account. The API endpoint is called with a single request body parameter: an event ID. When called, the flow attempts to retrieve details of the event with the specified ID from Eventbrite:

  • If an event with the ID exists, the attendees of that event are retrieved, and the API responds with details of the event and its attendees.
  • If an event with the ID doesn’t exist, a message is sent to Slack to indicate that the API was called with a non-existent event ID, and the API returns a 404 error.

The Eventbrite and Slack actions each contain fields that reference the event ID from the request to the API.

From the Request node, we’ll click the pencil icon Pencil icon to open the “Context and sample data” pane and then replace the value of the eventID request body parameter with the ID of a genuine event that exists in our Eventbrite instance.

The request of the API flow
Fig 2. The request of the API flow showing the edited sample data value of the request body parameter


Next, we’ll use the Eventbrite Retrieve events action to add a condition to retrieve details of the event ID that maps to the ID that was set in the request parameter, for a genuine Eventbrite event. The remaining nodes in the flow define the If condition and results described earlier.

Now, let’s test the If condition for when an event with the ID exists. When we click the Try this flow icon, the flow runs and a test result notification is shown in the upper right corner of the flow editor.

The mapping to the request parameter in the Eventbrite Retrieve events action
Fig 3. The Eventbrite Retrieve events action showing the mapping to the request parameter and the edited sample data value


We can view the test results by clicking the View details link in the test result notification. The “Test results” pane shows a summary of the test that was run, including the output from the API response. Here we can see that the flow returned three attendees, as well as some other information about the event.

The flow test result of the If branch
Fig 4. The flow test result of the “If” branch

 

To try the else branch of the If node, we’ll use the Regenerate sample data button in the Request node to set the value of the eventID request body parameter to a non-existent event ID.

This time, when we click the Try this flow icon, the test result notification indicates that the flow exited with an error.

The mapping to the request parameter in the Slack Create message action
Fig 5. The Slack Create message action showing the mapping to the request parameter and the edited sample data value

 

The “Test results” pane shows a summary of this test result. The pane also shows the results of any previous tests, and the results persist for as long as the flow is open.

The flow test result of the Else branch
Fig 6. The flow test result of the “Else” branch

 

Finally, we can check the instance for our connected Slack account, to verify that the expected message is generated for a non-existent event ID.

The Slack create message result
Fig 7. Slack Create message result

 

We hope that this article has shown how useful the “Try this flow” feature can be in developing your App Connect flows.


#AppConnect
#Flows
#APIflow
0 comments
47 views

Permalink