top of page
Writer's picturesreevidya malineni

API Management with Postman Flows

What is Postman Flow?


Postman Flows is a feature introduced by Postman, a popular API development platform, to help users streamline and automate their API workflows. It allows you to create sequences of requests and assertions, effectively modeling complex API interactions. With Postman Flows, you can define the steps that your API requests should follow, including conditional logic and branching based on the responses received.


In another words,Postman Flows provide a visual and structured way to define and execute complex API workflows, making it easier to test, debug, and automate your API interactions.


Where to create Flows in Postman?

  • Go to Workspace Settings on postman and enable Flows option

  • Click on flows-->Create New Flow

  • Provide the name of the Flow


How to create Flows?

  • When you create a new flow by default it contains the "START" block. In Postman, the "START" block serves as the entry point for your flow, marking where the execution begins. It's a foundational component present in every flow, providing structure and coherence to your sequence of requests and actions. Unlike other blocks, the "START" block cannot be deleted because it initiates the flow's execution.

  • Along with START Block there are other blocks can be used to construct your Flow.Listing few blocks that i'm going to use further in this blog. 1) Get Variable:Gets the specified variable's value from anywhere in the Flow.

2) Create Variable:Assigns a value to a variable that can then be accessed with the Get Variable block anywhere in the Flow. The input is any value (such as text, a number, or information from another block).

3) Select :Selects a specific part of the information output from another block. If the input information is from a Send Request block with a saved example, a drop-down will pop up that has all the information available to choose from and selecting that information will auto-fill the select block.

4) String :Outputs the text that you enter.

5) Log (Console):Displays the information input. The dropdown menu enables you to select from JSON, charts, tables, videos, images, and more.


There are many other blocks that supported by postman ,refer https://learning.postman.com/docs/postman-flows/gs/the-flows-interface/#blocks-on-the-canvas to read about supported blocks .


  • After the "START" block in a Postman Flow, the next step typically involves defining the sequence of actions or requests that you want to execute in your API workflow



Let's walk through the process of designing a basic API workflow in Postman for ordering a book using the public API you mentioned. We'll include requests for POST, GET, UPDATE, and DELETE operations.


  1. Create a collection and organize your POST,GET,UPDATE and DELETE Requests.

  2. When you create a new flow you will see the "Send a request" block from START block, click on it and select the first request from collection need to run after START block



Selecting Get request first to check the status of my API first as shown below






Designing your flow to handle both success and failure scenarios is crucial for robust API interaction.


3. From Get request I'm going to design my flow like if request is success then show the output ,for this i'm going to use the "OUTPUT" block and also for fail scenario also i'm going to print the message on OUTPUT block.




4. Click on Run Option for above flow.




As shown in above snippet my request ids success and result is showing on OUTPUT block


5. After Getting success status from an GET request API the next step i'm gonna design is send an POST request to register an user

For designing next step we can drag a connection from success output of GET request and select "Send Request" block.

6. Select Post Request API for registering user from the list of requests from your collection .



As shown above ,this request requires data such as "NAME" and "Email".We can pass data directly by clicking on "+" next the field's and select "String" block from the list and add your data directly in text box or We have another approach by creating variable blocks and sending those variables to those fields .


For creating the variables click on anywhere on flows and from the list of blocks select "Create Variable" and provide the name for the variable.

Next, provide data for the variable using "String" block and connect String block to the create variable block.



Select the created variable for the NAME field using "Get Variable" Block in POST Request.



Create Variable for Email the same way and pass the data.And added Output block to the success status .

Click on Run ,and check the result.




7. As seen on the above Screenshot Output of Register API request generates accesstoken and we need this accesstoken for the next requests.

We will be extracting the accesstoken from output of the POST Request using "Select" block and store it in variable ,so the we can use this token for multiple requests.



8. Next ,drag the connection from success of POST request and select next API request that is Ordering an book.

This Requires accesstoken and Name as request parameters ,pass accesstoken and name variables that created in earlier steps.





9. As shown above screenshot the output of Order book API response contains orderid and we need extract this orderid and use it for subsequent get, update and delete requests.

To extract Orderid from output we are gonna follow steps mentioned in step 7.



10. By following the above steps created the flow with GET,UPDATE and DELETE requests by using extracted access_token and order_id and designed end to end flow diagram for ordering an book API.




Above is my End to End flow diagram for an ordering book API.


Conclusion:

In Summary, flows are the ultimate way to take data from an API-enabled product, manipulate it to meet your needs, and see the results. Or you could take data from one API-enabled product, make decisions or process the data, then send it to another API-enabled product. This means you can build real-time integrations between two API-enabled products.






98 views

Recent Posts

See All
bottom of page