1 00:00:00,240 --> 00:00:06,900 As suggested by the last video we'll be making a ton of HDTV requests as we create and build out the 2 00:00:06,900 --> 00:00:09,270 task manager REST API. 3 00:00:09,270 --> 00:00:14,730 Now we already know we could make those requests from the browser to test our work as we build out the 4 00:00:14,730 --> 00:00:15,750 API. 5 00:00:15,750 --> 00:00:19,140 We've made HDTV requests from the browser before. 6 00:00:19,140 --> 00:00:20,490 In this class. 7 00:00:20,490 --> 00:00:26,430 But what I want to introduce in this video is a new tool that's gonna make it much easier to quickly 8 00:00:26,430 --> 00:00:34,380 fire off all the TTP requests we need allowing us to test and verify that our REST API is working as 9 00:00:34,380 --> 00:00:35,370 expected. 10 00:00:35,370 --> 00:00:40,490 The tool is postmen and it's basically an industry standard for what it does. 11 00:00:40,500 --> 00:00:42,870 Let's get started by installing postman. 12 00:00:42,870 --> 00:00:46,710 We can head over to the Web site in order to grab the installer. 13 00:00:46,710 --> 00:00:51,420 Right here you are L is get postman dot com. 14 00:00:51,510 --> 00:00:58,220 Now postman is indeed a tool available for all operating systems and it is indeed free as well. 15 00:00:58,230 --> 00:01:02,400 They have paid plans but they offer features that we don't need for the course. 16 00:01:02,430 --> 00:01:04,240 Things like data synchronization. 17 00:01:04,260 --> 00:01:10,410 If you're working on an API with multiple developers that might be useful later on as you start to build 18 00:01:10,440 --> 00:01:13,550 out node apps on your own and you are collaborating. 19 00:01:13,560 --> 00:01:15,700 But for now it's not necessary. 20 00:01:15,840 --> 00:01:21,890 Right here we can download the application and I'm going to go ahead and grab the Mac Download Now as 21 00:01:21,900 --> 00:01:28,710 mentioned there are download options available for Mac Windows and for Linux so take a moment to grab 22 00:01:28,710 --> 00:01:31,670 the correct installer for your operating system. 23 00:01:31,680 --> 00:01:37,890 We're going to get it installed and we're going to fire off an H TTP request using postmen to make sure 24 00:01:37,890 --> 00:01:40,470 that it's actually working as expected. 25 00:01:40,470 --> 00:01:47,070 Then as we build out the rest api throughout the section we'll be able to easily fire off requests to 26 00:01:47,070 --> 00:01:50,440 test our work using the postman tool. 27 00:01:50,490 --> 00:01:53,540 The goal of postman isn't to replace a client. 28 00:01:53,550 --> 00:02:00,840 The goal is to allow us to test our REST API without having to also create a client to test it with. 29 00:02:00,960 --> 00:02:06,570 That's going to allow us to automatically test things like signing up a user with valid data and then 30 00:02:06,570 --> 00:02:11,040 signing them up with invalid data making sure we get the correct response. 31 00:02:11,040 --> 00:02:16,800 Now on a Mac I get the application file and all I'm going to do is drag this over to my applications 32 00:02:16,800 --> 00:02:17,680 directory. 33 00:02:17,790 --> 00:02:23,010 The installation process for each operating system will be slightly different and once it's over there 34 00:02:23,010 --> 00:02:24,940 we can go ahead and fire it up. 35 00:02:24,990 --> 00:02:30,180 So feel free to pause the video until you've install the postman then we're gonna take a moment to crack 36 00:02:30,180 --> 00:02:32,670 it open and get familiar with the tool. 37 00:02:32,850 --> 00:02:38,910 Now throughout using postmen they're going to try to get you to create an account that is not necessary. 38 00:02:39,000 --> 00:02:43,390 So whenever they say you have to create an account there's always a way to skip it. 39 00:02:43,440 --> 00:02:49,080 There's no need to sign up for their web service which would be useful if you were trying to do things 40 00:02:49,080 --> 00:02:50,870 like collaborate with others. 41 00:02:51,000 --> 00:02:54,300 Right here we're going to skip the sign up step down below. 42 00:02:54,300 --> 00:02:59,880 There is a link to do just that and this is going to bring us right into the postman tool. 43 00:03:00,000 --> 00:03:05,510 Now right off the bat they're trying to give us some helpful suggestions guiding us along the way. 44 00:03:05,580 --> 00:03:08,900 We're gonna get started by creating a basic request. 45 00:03:08,960 --> 00:03:17,350 We're going to do is fire off an HDTV request for that weather API we created earlier in the class though 46 00:03:17,370 --> 00:03:21,510 we're going to do that from postmen as opposed to doing it from the browser. 47 00:03:21,510 --> 00:03:26,580 As long as that works then we know the tool is set up correctly and we can move on to the next video 48 00:03:26,790 --> 00:03:30,900 and actually start creating the endpoints for the task API. 49 00:03:30,900 --> 00:03:33,150 I'm gonna name this particular request. 50 00:03:33,150 --> 00:03:35,880 Get Weather now down below. 51 00:03:35,880 --> 00:03:42,150 We don't have to provide a description but it is gonna ask us to put this request in a collection and 52 00:03:42,150 --> 00:03:48,180 a collection is nothing more than a folder where you can store related requests so you might have multiple 53 00:03:48,180 --> 00:03:51,450 folders for the different projects you're working on. 54 00:03:51,450 --> 00:03:54,690 Down below we can create a new collection right here. 55 00:03:54,690 --> 00:03:57,480 I can call this something like weather app. 56 00:03:57,480 --> 00:04:01,430 Oh well requests inside of there will be for the weather application. 57 00:04:01,530 --> 00:04:06,960 Click the checkbox select it and now we're ready to create the new request. 58 00:04:06,960 --> 00:04:12,390 So once I go ahead and click save it's going to bring us over to the main postman screen. 59 00:04:12,390 --> 00:04:18,360 I'm going to make my postman window just a little bit wider so we can see the entire application on 60 00:04:18,360 --> 00:04:18,860 the left. 61 00:04:18,870 --> 00:04:24,690 We have the history of the requests we've made in the past and we also have our collections. 62 00:04:24,690 --> 00:04:29,270 We have just one and if we open that there is a single request inside. 63 00:04:29,340 --> 00:04:34,090 Now there is a whole lot into the postmen interface and it can be a bit overwhelming but we're going 64 00:04:34,090 --> 00:04:37,890 to go step by step and work with a basic request. 65 00:04:37,890 --> 00:04:40,620 So right here we have our request showing up. 66 00:04:40,620 --> 00:04:46,500 If you don't have that you can always close all tabs and then just click the request and that will bring 67 00:04:46,500 --> 00:04:48,150 it up right here. 68 00:04:48,150 --> 00:04:54,300 So now we are firing off this request but it hasn't been configured so it's not actually going to work. 69 00:04:54,300 --> 00:04:56,450 We have two main pieces of information. 70 00:04:56,580 --> 00:04:58,310 We have the H TTP method. 71 00:04:58,320 --> 00:05:04,210 We want to it and we have you are well we're trying to make the request to down below. 72 00:05:04,270 --> 00:05:10,870 We have additional ways to configure the query string authorization headers and request body and more 73 00:05:11,200 --> 00:05:11,860 for the moment. 74 00:05:11,860 --> 00:05:14,330 We're just going to stick with these two. 75 00:05:14,410 --> 00:05:21,100 We're going to leave it at get since we set up the weather API to use the get h TTP method. 76 00:05:21,100 --> 00:05:24,380 Then we're going to provide the U.R.L. we had configured. 77 00:05:24,460 --> 00:05:29,710 Now you could always use the U R L for your weather application if you don't have that or you forget 78 00:05:29,710 --> 00:05:29,840 it. 79 00:05:29,860 --> 00:05:40,720 You can just use mine that is h TTP s colon forward slash forward slash Mead weather application dot 80 00:05:40,930 --> 00:05:43,170 Heroku app dot com. 81 00:05:43,240 --> 00:05:48,750 Then we set up forward slash whether as the end point allowing you to actually fetch that weather. 82 00:05:48,820 --> 00:05:53,660 Now we know we need to provide the address and we can do that in one of two ways. 83 00:05:53,770 --> 00:06:00,130 I could type it right and line up above or I could configure it down below under Parameter setting up 84 00:06:00,130 --> 00:06:04,530 the key and value and postman will do the heavy lifting for me. 85 00:06:04,540 --> 00:06:11,230 So in this you are ALBAR I can use the question mark to set up my key value pair the key being address 86 00:06:11,500 --> 00:06:17,170 and I'll set that equal to Philadelphia and I can see those fields have been automatically populated 87 00:06:17,170 --> 00:06:18,190 down below. 88 00:06:18,280 --> 00:06:25,210 If I change them down below like changing the value from Philadelphia over to Boston spelled correctly 89 00:06:25,510 --> 00:06:27,630 we're gonna see that you are well up above. 90 00:06:27,640 --> 00:06:29,320 Automatically updates. 91 00:06:29,410 --> 00:06:35,050 So postman gives us all of the tools we need to allow us to test our API and points. 92 00:06:35,050 --> 00:06:39,610 It's a very fantastic tool and we'll be using it throughout the rest of the class. 93 00:06:39,640 --> 00:06:42,020 Right here we can go ahead and save this. 94 00:06:42,040 --> 00:06:44,710 We can then use send to fire it off. 95 00:06:44,710 --> 00:06:49,810 It's actually going to communicate with our server and get the weather response down below. 96 00:06:49,810 --> 00:06:55,570 We see just that we have the pretty printed Jason formatted in a way that's easier to read. 97 00:06:55,570 --> 00:07:03,100 We have our forecast our location and the address exactly what we got when we made the TTP request from 98 00:07:03,160 --> 00:07:03,920 the browser. 99 00:07:03,970 --> 00:07:06,550 Now up above we have other tabs as well. 100 00:07:06,550 --> 00:07:13,480 Right here I can view the raw response body here I just have the UN predefined Jason and I also have 101 00:07:13,480 --> 00:07:19,620 the preview tab which allows me to view it as plain text though when we're working with Jason API is 102 00:07:19,630 --> 00:07:22,440 using that pretty tab is the nicest. 103 00:07:22,480 --> 00:07:27,820 Now there's a lot of other stuff going on here as well that we will explore as we continue to use the 104 00:07:27,820 --> 00:07:28,550 tool. 105 00:07:28,570 --> 00:07:30,790 For example I can see these status code. 106 00:07:30,790 --> 00:07:32,730 I got back a two hundred. 107 00:07:32,740 --> 00:07:38,360 I can see the amount of time things took and I can see the size of the HDTV response. 108 00:07:38,380 --> 00:07:40,920 All very valuable information. 109 00:07:40,990 --> 00:07:46,930 Now if I were to close this tab and come back to man later I could always just click that item from 110 00:07:46,930 --> 00:07:49,830 the collection all of my data has been saved. 111 00:07:49,840 --> 00:07:53,710 I can fire it off and ensure that things are working as expected. 112 00:07:53,710 --> 00:08:00,220 So as we add a new end points to the task manager Rest Api we'll be setting those up as requests in 113 00:08:00,320 --> 00:08:05,740 postmen making it really easy for us to ensure that things are working as expected. 114 00:08:05,770 --> 00:08:10,630 That's where we're gonna stop for this one we'll be setting up our very first end points in the next 115 00:08:10,630 --> 00:08:11,370 video. 116 00:08:11,440 --> 00:08:13,300 So let's go ahead and jump into that.