Postman Flows: 5 Example Flows

In my earlier blog posts, I’ve taken a high level look at the Flows beta feature, and delved a bit deeper into what each of the blocks that make up flows actually do.

However, I think when we’re learning, itโ€™s good to have examples we can refer to – that’s always the shortcut I use to get inspired anyway! So here are some working examples I created to help get those creative juices flowing. Note these are all basic flows that may form part of a larger flow should you wish to do something more advanced.

All of my flows use the Restful Booker API, written and maintained by the amazing Mark Winteringham.

Flow #1: Passing Variables Between Requests

In this instance, we create a new booking, and pass the created booking ID to a request to GET the information about that ID. This is done via the the “assign values to variables” link within a request without the need to use the now deprecated Assign Variables/Create Variables blocks.

NOTE – pay attention to those yellow warning triangles in the send request – the block will not recognise the response body data unless they have been defined in an example first.

Video showing use of “Assign values to variables” link to define and pass variables – remember to create an example first!

Flow #2: Looping data

*Updated May 2022* If you want to loop through a response and apply a rule to it then here is an example. Here I take the ID’s from a GET all request, loop through them using a FOR EACH loop and for each of the ID’s in the request I output to a terminal if the booking id is greater than 100.

For Each Loop Highlighted in Green

Another way to do this is via the Create Data/Loop Over List flow, also shown above. Using these blocks, I also execute a further request using the ID from the loop e.g. to GET information on the booking. I then output the test run results to a test summary.

The steps are as follows:-

  • Ensure you have an example saved in your collection for the requests you wish to use in the Flow
  • Add a Send Request block
  • Add a Create Data block, using the data input to select a value (in this case /data/body/ which is a list of booking ID’s)
  • add a Loop Data Until block, which tells the flow you want to do something with the data you’ve created
  • Add further blocks to do that thing e.g. Send Request (adding the variable of bookingid you’ve generated above) or conditional logic
  • (optional) to convert the data back to its original state, add an End Loop Block
  • Add Terminal/Test Summary Blocks to output the data so you can ensure it works – it will dynamically update with new information each time the data passes through the loop

    Joyce Lin has also done a video here showing another fantastic use of loops.
Video showing for each loop logic (version 9.19 of Flows beta)

Flow #3: Take Inputs From Multiple Sources

This example shows how you can take requests running against two different environments from two different collections and perform a check on them both to output to a terminal.

Video showing outputs from two API requests flow into the same check block in Postman Flows

Flow #4: Passing Data Between Requests

From version 9.5.0, you can use the Create Durables block to complete the task of passing data between requests – as long as you have created an example api request first! By adding the token as a durable type, the generated value can be persisted throughout the flow.

Video showing data being passed through a Postman Flow using Data Durables – Remember to create an example first!

Flow #5: Generating a Test Summary Report

My faveflow! Takes tests run as part of 3 different requests and outputs the results to a single Test Summary Block.

I hope these will help you to see how Flows might be useful to you in your testing endeavors. Watch this space for news of a fun live stream using these flows with Postman themselves – exciting huh!

Bye for now ๐Ÿ‘‹

4 thoughts on “Postman Flows: 5 Example Flows

  1. I send a request to receive a list of peoples. And then I want to send request for detail info about one choosed man. I want to pass value from set of ids from first request to second. Not first id and not second – random of ids. How can I make this?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: