Do you build APIs? Then this shot is for you! Postman is a tool that can help you locally test your APIs.
In this shot, I will not teach you how to build API endpoints as I am assuming that you know how and may even have some already.
What we will be covering:
Before going into depth, lets make sure we have the same understanding.
Imagine you’re building a restful API with NodeJS/Express. Let’s call it wayfarer-app and say it’s a public transportation app. So, you want to send out a list of available trips to the user.
You may have this route localhost:5000/api/v1/trips
, but how do you test it? Well, without a testing tool like Postman
, you can use the curl
program, which is a CLI tool available
In curl you would just use this command, curl localhost:5000/api/v1/trips
.
However, this will not help you if you are building a complex app. This is where a graphical client may help.
Postman is an API platform for building and using APIs.
Now, you are ready to get Postman. You have two possibilities:
You can choose what you want for the basic features, but the desktop app comes with many more features than the plugin. In this shot, we will be using the desktop version. Visit the site to download it. Postman is available in all main desktop OS.
After a while, you’ll have the executable with you. Proceed with the installation as you usually do on your OS. It’s just an app.
Note: For your information, if you’re using a GNU/Linux like Debian, Postman is a portable app, so you just need to double-click the unzipped app to run it. No installation required.
GET
request
GET
) on the left corner of the screenshot attached belowSend
buttonPOST
request
Change the method to POST
the put the right route, then hit the sen
button (see image above).
Test any method
I think you now understand how to test the GET
and POST
method. If so, you can do the same for anyone you want to, be it PATCH
, DELETE
, etc.
That is it for today. I hope you have appreciated this shot. I have explained to you how to use a tool to test your API endpoints. Don’t forget to share the post around.