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.
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 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.
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.
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.
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 “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.
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.
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