As suggested by the last video we'll be making a ton of HDTV requests as we create and build out the
task manager REST API.
Now we already know we could make those requests from the browser to test our work as we build out the
API.
We've made HDTV requests from the browser before.
In this class.
But what I want to introduce in this video is a new tool that's gonna make it much easier to quickly
fire off all the TTP requests we need allowing us to test and verify that our REST API is working as
expected.
The tool is postmen and it's basically an industry standard for what it does.
Let's get started by installing postman.
We can head over to the Web site in order to grab the installer.
Right here you are L is get postman dot com.
Now postman is indeed a tool available for all operating systems and it is indeed free as well.
They have paid plans but they offer features that we don't need for the course.
Things like data synchronization.
If you're working on an API with multiple developers that might be useful later on as you start to build
out node apps on your own and you are collaborating.
But for now it's not necessary.
Right here we can download the application and I'm going to go ahead and grab the Mac Download Now as
mentioned there are download options available for Mac Windows and for Linux so take a moment to grab
the correct installer for your operating system.
We're going to get it installed and we're going to fire off an H TTP request using postmen to make sure
that it's actually working as expected.
Then as we build out the rest api throughout the section we'll be able to easily fire off requests to
test our work using the postman tool.
The goal of postman isn't to replace a client.
The goal is to allow us to test our REST API without having to also create a client to test it with.
That's going to allow us to automatically test things like signing up a user with valid data and then
signing them up with invalid data making sure we get the correct response.
Now on a Mac I get the application file and all I'm going to do is drag this over to my applications
directory.
The installation process for each operating system will be slightly different and once it's over there
we can go ahead and fire it up.
So feel free to pause the video until you've install the postman then we're gonna take a moment to crack
it open and get familiar with the tool.
Now throughout using postmen they're going to try to get you to create an account that is not necessary.
So whenever they say you have to create an account there's always a way to skip it.
There's no need to sign up for their web service which would be useful if you were trying to do things
like collaborate with others.
Right here we're going to skip the sign up step down below.
There is a link to do just that and this is going to bring us right into the postman tool.
Now right off the bat they're trying to give us some helpful suggestions guiding us along the way.
We're gonna get started by creating a basic request.
We're going to do is fire off an HDTV request for that weather API we created earlier in the class though
we're going to do that from postmen as opposed to doing it from the browser.
As long as that works then we know the tool is set up correctly and we can move on to the next video
and actually start creating the endpoints for the task API.
I'm gonna name this particular request.
Get Weather now down below.
We don't have to provide a description but it is gonna ask us to put this request in a collection and
a collection is nothing more than a folder where you can store related requests so you might have multiple
folders for the different projects you're working on.
Down below we can create a new collection right here.
I can call this something like weather app.
Oh well requests inside of there will be for the weather application.
Click the checkbox select it and now we're ready to create the new request.
So once I go ahead and click save it's going to bring us over to the main postman screen.
I'm going to make my postman window just a little bit wider so we can see the entire application on
the left.
We have the history of the requests we've made in the past and we also have our collections.
We have just one and if we open that there is a single request inside.
Now there is a whole lot into the postmen interface and it can be a bit overwhelming but we're going
to go step by step and work with a basic request.
So right here we have our request showing up.
If you don't have that you can always close all tabs and then just click the request and that will bring
it up right here.
So now we are firing off this request but it hasn't been configured so it's not actually going to work.
We have two main pieces of information.
We have the H TTP method.
We want to it and we have you are well we're trying to make the request to down below.
We have additional ways to configure the query string authorization headers and request body and more
for the moment.
We're just going to stick with these two.
We're going to leave it at get since we set up the weather API to use the get h TTP method.
Then we're going to provide the U.R.L. we had configured.
Now you could always use the U R L for your weather application if you don't have that or you forget
it.
You can just use mine that is h TTP s colon forward slash forward slash Mead weather application dot
Heroku app dot com.
Then we set up forward slash whether as the end point allowing you to actually fetch that weather.
Now we know we need to provide the address and we can do that in one of two ways.
I could type it right and line up above or I could configure it down below under Parameter setting up
the key and value and postman will do the heavy lifting for me.
So in this you are ALBAR I can use the question mark to set up my key value pair the key being address
and I'll set that equal to Philadelphia and I can see those fields have been automatically populated
down below.
If I change them down below like changing the value from Philadelphia over to Boston spelled correctly
we're gonna see that you are well up above.
Automatically updates.
So postman gives us all of the tools we need to allow us to test our API and points.
It's a very fantastic tool and we'll be using it throughout the rest of the class.
Right here we can go ahead and save this.
We can then use send to fire it off.
It's actually going to communicate with our server and get the weather response down below.
We see just that we have the pretty printed Jason formatted in a way that's easier to read.
We have our forecast our location and the address exactly what we got when we made the TTP request from
the browser.
Now up above we have other tabs as well.
Right here I can view the raw response body here I just have the UN predefined Jason and I also have
the preview tab which allows me to view it as plain text though when we're working with Jason API is
using that pretty tab is the nicest.
Now there's a lot of other stuff going on here as well that we will explore as we continue to use the
tool.
For example I can see these status code.
I got back a two hundred.
I can see the amount of time things took and I can see the size of the HDTV response.
All very valuable information.
Now if I were to close this tab and come back to man later I could always just click that item from
the collection all of my data has been saved.
I can fire it off and ensure that things are working as expected.
So as we add a new end points to the task manager Rest Api we'll be setting those up as requests in
postmen making it really easy for us to ensure that things are working as expected.
That's where we're gonna stop for this one we'll be setting up our very first end points in the next
video.
So let's go ahead and jump into that.