Why create this repository?
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.
One of the main reasons why I'm a huge advocate of the tool, is the supporting documentation and learning guides that have 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 few links to some alternative REST clients - Just to prove that I'm not 100% 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!
Paw is a full-featured HTTP client that lets you test and describe the APIs you build or consume. It has a beautiful native macOS interface to compose requests, inspect server responses, generate client code and export API definitions.
Restlet Client is the most popular REST client available as a Chrome extension. It automatically updates itself, can be opened in one or several browser tabs and comes with a convenient browser toolbar icon.
These are all 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 requirements, in your given context.
Let's get started!
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)
- Tests (Chai style assertions)
- In-Built Test Runner
- Newman command line collection runner
- Postman Console
- Using some built in modules like
- Data Driven Tests
- Forking and Merging Collections
- Creating Mocks
- And 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.
In this example we will send a request using the
/ping route to ensure that the API is active and able to receive requests.
02 Create an Environment file
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.
04 Preset Headers
For this example we will be looking at the Preset Headers feature.
05 Importing Files
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.
07 Creating our first test
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.
08 Extending our tests
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.
09 Global and Dynamic variables
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.
11 Dynamically create new bookings
For this example we will be using Postman to dynamically generate data using some of the built-in modules to create new bookings.
12 Introduction to the Collection Runner
In this example we will be looking a bit closer at the
Collection Runner which allows us to run a series of requests.
More examples to follow shortly...
I've been a bit absent from this project for a while and the Postman application has moved on quite quickly without me :( - Have no fear, I will be expanding on the current examples and creating new ones that include some of the awesome features that have been added recently!! If there is something here that you're not sure about or you want to have a chat through - Please do grab me, I'm always here to talk!! :)
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
- A basic node express app for running Postman Collection from a Slack Channel
- A new HTML reporter for Newman offering a few extra features on top of the standard one
- An intro into how you can start creating your own custom HTML reports
I'm always available to chat over on Twitter @dannydainton and I've 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 :)