Wait A Minute Mr. Postman — An Introduction to Postman
If your anything like me you cant help but hear Please Mr. Postman by The Marvelettes anytime you launch the Postman application. An iconic song about love, longing and known for being one of the first songs to reach the number one spot on the Billboard Hot 100 pop single charts in the early ’60s. If there is any comparison that could be made here its that Postman is loved by millions of developers, hundreds of thousands of companies and holds an infinite amount of API’s at its disposal. So what exactly are API’s? What is Postman? and how to do we leverage these to help create and deploy our own applications.
API
Lets begin with what exactly is an API or Application Program Interface. Wikipedia would tell you “An application programming interface (API) is a computing interface which defines interactions between multiple software intermediaries. It defines the kinds of calls or requests that can be made, how to make them, the data formats that should be used, the conventions to follow, etc.” What does all that all really mean? Well think of API as grocery store. In that store there are vast amount of prepackaged items that are used to help us cook, anything from caned foods, vegetables, fruit. In our case as developers we can think of these items as prebuilt code that we only need to access to create our applications. They may contain access to a given city for example, and in that city you pull information about the current weather; such things as temp, pressure, humanity. This type of information can be very powerful by giving developers access to hard data to help build and maintain our own applications.
POSTMAN
You may be asking, well API’s sound great! but what does this have to do with Postman? Good question, Postman is a developers best friend when it comes to using API’s. It accomplishes this by helping us flesh out and test our own API’s or use a given API to get information we need to build our own projects. To get started all we need to do is head to over to Postman.com. Here we can get the most up-to-date information on Postman. Also a guide to install to get it up and running on our own local machine.
Postman has so many tools in its arsenal, everything from creating, generating API requests, automated testing, mock servers, version control and so much more. It will be impossible for me to cover everything in this blog post, I will be just showing a quick way to query an API using GET, but I encourage anyone who would like to learn more to head over to the Postman learning center. I will link some resources below to help get more information on documentation and video walk through on YouTube. I will also be working with a weather API below, if you would like to check this out yourself you can head over to https://openweathermap.org/ and get yourself a API key to query your own data.
GET
Your first time logging into to Postman it will ask you to create an account, your can skip this however by clicking option on the bottom if you would like to just check out what Postman is all about. Alright now that were in we can check out some key features. Of course the biggest one is turning on Dark mode on the front page, am I right? All kidding aside, to get information about an API we may be working with we can go under “Start something new” and then click on “create a request.” Once here, the default drop down should be set to GET, we simply need to type in the URL we are working with, for example:
https://api.openweathermap.org/data/2.5/weather?q=Seattle&APPID=f87abd5021c3b6e304fd32ab9b363c39
Once we enter in our URL we can click on SEND and it will give us a whole list of option to choose from to help dissect and discern the information we might need.
The URL we typed in above is an example of a API query. Here we are querying the API for openweathermap.org and then using the syntax, “?q=” — to query the city that we want to view. After that we use, “&APPID=” and our key that was generated by openweathermap.org to allow us to use their database. Each API key that is provided by openweathermap.org is unique and wont be allowed to be used except for the intended user.
Now that we understand whats going with our query we can get into the nitty-gritty. From here you have access to a whole host of different options. Such things as Keys and Values to specify your queries, this allows you to do things like passing in your APPID for your API. There’s also the option for Authorization that allows you get access such as through a username and password when working with an API. You also get access to headers which allows you to set up your requests to the server.
Below that you get access to things such as the body which is the actually contents in the API. You can change how you would like to view this information such as seeing it in a clean view with Pretty or just in Raw text form. There is also a drop down box to the right that always you to change how you would like the information being output such as with JSON or HTML format. At the bottom of the page you also additional tools such as hiding our side bar, running find and also the console which will show you the break down of your requests being sent.
This is just a quick look at using a GET request with Postman. Its quiet easy to see how powerful this application can be to help build, maintain or debug API’s. Tools as these are by designed to make developer lives easier and for this we are eternally grateful.