All-Things-Postman
Update:
It's been very difficult for me to keep this repo up to date, with the current version. Since creating this repo my professional life has changed a lot - I'm now working full time for Postman and my efforts have all been about learning a new role and contributing to the whole Postman project, in a number of other different ways.
That change has had a huge impact on what I wanted to initially achieve with this repo, I'm still going to chip away at it and try and keep things up to date but as new UI changes and new functionality is being added all the time, it kinda gets away from me.
I still believe that the examples and the approaches within them are still valuable to Postman users but the media content is getting slightly dated and might look slightly different from the current UI. Once I'm in a good place, time wise, I will be updating this repo with more examples.
There is a great new Intro to Postman series on Postman's YouTube Channel created by Valentin Despa which is well worth checking out of you're just getting started with Postman - https://www.youtube.com/playlist?list=PLM-7VG-sgbtAgGq_pef5y_ruIUBPpUgNJ
If there is anything that you would like help with or need some more information about, I would recommend dropping a message onto our community site. It's growing all the time and it currently has some very valuable information within multiple Postman specific topics.
Thank you for all the support so far, means a lot to me! :)
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.
You can keep up to date with these changes via the Release Notes and by subscribing to the Postman Blog. As well as these, there is also have a Better Practices Medium site full of really cool Postman usecases.
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 :)
Insomnia
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.
REST Client
VSCode extension giving you the ability to make API requests from inside the editor. Really cool!
Paw
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
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)
- 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
- Data Driven Tests
- Forking and Merging Collections
- Workspaces
- Monitoring
- 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!
Example Guides
All requests in the examples will be made to the Restful-Booker API - You can find the available endpoints here.
Release Notes
Current Postman version being used: 6.3.0 Windows x64 -- I'm currently using version 7 on the MacOS but the images and gifs were created with the version and OS listed above so I won't change this until I fully update the repo.
GET
/ping
01 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.
GET
/booking
03 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.
GET
/booking/{id}
06 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.
POST
/booking
10 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...
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 :)