If you’ve ever worked on a real-world app or website before, you’ve probably had to use APIs. And if you did, you know how cumbersome testing them can be, because you have to set up your way for creating requests, manage tokens, and so on, before actually doing any of the real work. So you’re basically spending time building a shadow dev environment which you’ll throw away after you’re done testing anyway. What if you told you that there’s a better way? The Postman way.
API, short for Application Programming Interface, are ways of communicating with 3rd parties programmatically. They’re used to leverage another party’s features. I have an introductory article on them, here, if you want to learn more.
What is Postman?
Postman is an app which allows you to create HTTP requests. The difference between it and a browser is that Postman allows you to also control what headers or POST data you sent. This becomes valuable when you’re testing APIs because it’s basically all you need to test one.
You can download Postman here, and install it like any other app. It works on all platforms.
Creating a Request
Once installed, you can open Postman and start creating requests as you please. You can think of Postman just like another web browser, but with more flexibility around building a request.
To create an API request, you need to generally do 3 things:
- Enter the endpoint URL
- Setup the authorization
- Enter the additional parameters, headers or POST data
Enter the Endpoint URL
This is pretty straightforward, you simply paste it into the “Enter request URL” field.
Setup the Authorization
Some APIs require authorization, hence we will need to set it up in Postman too, to be able to test out the APIs. This is made very easy to use by Postman. Simply choose the Authorization tab, then choose the type of auth that your API is using, and follow the on-screen instructions. You only need to set this up once.
Enter the Additional Parameters, Headers or POST Data
All of these types of request meta information have their separate tab which you can use to define them. You just fill the information in and press Send. Once you press Send, you’re going to retrieve the response of the API.
There are a lot of other options featured on this tool, but I encourage you to give it a go and play with it.