I've been using Postman for a while now and I'm still uncovering features that I didn't even know existed - There are a number of How-To guides out there explaining how to use the tool's feature set but as the platform is constantly evolving these can become out of date, really quickly.
My goal is to create a space where I can show examples of some of the many features in the tool and for it to also be a living piece of documentation, that will change over time to reflect the new changes being released.
You can keep up to date with these changes via the Change Log and by subscribing to the Postman Blog.
One of the main reasons why I'm a fan of the tool is the supporting documentation that has been created - Although I will be covering some of the same features I will be including usable content that you can import into your own instance and work through the example at a pace that suits you.
Before I start explaining the many different amazing and wonderful features of Postman, I just wanted to share a couple of links to some alternative REST clients - Just to prove that I'm not completely bias towards Postman :)
A similar tool to Postman and packed full of cool features. The ability to filter the response data is awesome! Alan Richardson Created a great video explaining some of the features of the tool 3 Reasons to use Insomnia REST Client in your Exploratory API Testing.
VSCode extension giving you the ability to make API requests from inside the editor. Really cool!
These are both excellent REST clients and well worth checking out - Ultimately, It's all down to personal preference and It's completely up to you, to find what meets your own requirement, in your given context.
I've made a huge assumption that if you're reading this you will probably have Postman downloaded and installed on your machine already - If you don't that is not a problem, just head over to the Postman site and grab the flavour that suits your OS. Once you're done - Be sure to come back again. :)
The tool on it's own is quite useless, in order for us to start having some fun and making requests, we need an API with some endpoints that will return some data - This is where a wonderful resource provided by Mark Winteringham comes in handy! Mark has created Restful-Booker, a safe place for people to learn more about API testing and a active platform to try out tools like Postman or any of the other REST clients mentioned.
"Restful-booker is a Create Read Update Delete (CRUD) Web API that comes with authentication features and loaded with a bunch of bugs for you to explore"
I would recommend taking a look through the API documentation to get a feel for the type of requests we will be making within the example guides. We'll get very familiar using the GET, POST, PUT and DELETE verbs and pairing these with the powerful features of Postman.
All the requests that we will be making, will be included in a collection
file, that can be imported directly into your local Postman application. It will start quite basic but we will be building these collections and incorporating features such as:
- Collection, Environment and Global Variables
- Preset Headers (Saving you a bunch of time)
- Pre-Request Scripts (Writing basic JavaScript to create new data with each request and other cool things)
- Tests (Chai style assertions)
- In-Built Test Runner
- Newman command line collection runner
- Postman Console
- Using some built in modules like
moment
andLodash
- Many more...
The format will take the form of a series of individual pages where I will explain in a bit more detail what I'm actually doing in Postman when making the requests and this will be backed up by images, gifs, code snippets etc. to try and make the information come to life. I'm a Tester so you can expect me to make observations along the way and I will be noting these down but the main focus of the examples we always be, using Postman and it's features to request data from the Restful-Booker API.
It will be an ever evolving space so if you would like me to add details covering certain features or to expand the examples in the repository - Please give me a shout @dannydainton I'm always available to chat!
All requests in the examples will be made to the Restful-Booker API - You can find the available endpoints here.
Current Postman version being used: 6.3.0 Windows x64 - Release Notes
In this example we will send a request using the /ping
route to ensure that the API is active and able to receive requests.
In this example we will be creating an Environment file and using data from this file within our requests.
For this example we will be making requests to the /booking
route and using some different parameters in the requests to filter the response data.
For this example we will be looking at the Preset Headers feature.
In this example we will look at some of the methods of importing various different files into Postman.
In this example we will be getting the data for a single booking from the API. We will explore the endpoint using Request Headers
and also taking a basic look at the Pre-request Scripts
feature to make our request a little bit more dynamic.
In this example we will be taking our first look at the Tests
feature. We will create a basic test to assert against some response data returned from the Restful-Booker API.
For this example we will be taking the knowledge gained from creating our first basic test and extending this to cover more of the response data.
In this example we'll be looking at how to Create, Use and Clear Global variables. We will also be taking a look at the Dynamic Variables that Postman offers.
In this example we'll be using the POST
method to send data to the /booking
endpoint and create some new bookings based on the information we provide in the request.
For this example we will be using Postman to dynamically generate data using some of the built-in modules to create new bookings.
In this example we will be looking a bit closer at the Collection Runner
which allows us to run a series of requests.
As well as this repository, I have also continued to blog about some additional Postman features:
- Hold on, wait a moment...
- Dynamically unset Postman Environment Variables
- Postman and Lodash - The perfect partnership
- Postman - The Bearer of good news
- Using Newman to run a collection of requests through TravisCI
- Running Postman Collections with Docker and creating custom HTML reports
I'm always available to chat over on Twitter @dannydainton and I've recently started answering questions on Stackoverflow under the postman tag, so if you do have a specific problem, just jump over to there and I'll try my best to help :)