Automate your requests using Postman Collections – Part #1.

We usually use the Postman to send requests to our APIs and get a response. All the requests that we send come under history so that we could re-use the requests. But this is a manual approach.
So the questions that rises are:

  1. Why use Postman collections?.
  2. Why would we need to automate them?

We will be going through the answer to the first question here. And will be covering the rest in the second part.
So the answer for the first one is: We can work with requests and history for a small set of requests, But once your history of requests scales up, finding a particular request in your history can become time-consuming.
And to handle this situation, we could use the Postman Collections.

What is a Postman Collection?

A Postman Collection lets us group individual requests together and we can organize these requests in folders.We can provide descriptions and logical names for these folders. We can create and publish API documentation pages.
We can automate these requests and we can add test scripts to requests and build integration test suites.

Step 1: Create a collection

postman1

postman2

Step 2: Provide documentation for the collection, if required.

postman3

Step 3: Click on the save button of the request and add the request to the particular collection.

postman4

postman5

Note: We can also save the responses as sample responses. This could help to reflect the expected responses.
Just click on the save response. And give some description-name.

postman6

So here it is, a basic scenario with postman collections. But we could do a lot more:
– We could import and export the collections.
– We could duplicate collections and customize them.
– And of course, there will be multiple requests, not a singular one, under one collection.

So,  now we have created a postman collection. But it’s working on pre-defined values for the request. But there comes a scenario, when we have to use dynamic request parameters, we have to perform some modifications before and after the requests have been sent.

And we will be discussing those scenarios/requirements and the ways Postman provides to implement automation.

Till then keep going through our blogs. Because at Knoldus we believe in sharing knowledge.

knoldus-advt-sticker

Written by 

Anmol Mehta is a Software Consultant having experience of more than 1.5 years. A keen programmer who has experience in Scala and Java. He is recognized as a dedicated and determined team player who enjoys working on new technologies. He is a professional and a technology enthusiast. He believes in the approach that “teamwork makes the dream work”. He is a quick and always-on learner who ensures better quality in every increment of his work. He believes in abiding standard coding practices. He always looks after that the team is working in sync with each other both at the technical and managerial level.

1 thought on “Automate your requests using Postman Collections – Part #1.

Leave a Reply

%d bloggers like this: