1 00:00:00,930 --> 00:00:04,950 All right, so for an example of something that's using that metadata that we 2 00:00:04,950 --> 00:00:09,860 just saw, let's take a look at the HAL browser which again stands for 3 00:00:09,860 --> 00:00:12,080 hypermedia application language. 4 00:00:12,080 --> 00:00:16,100 Now the HAL browser requires an extra dependency, but 5 00:00:16,100 --> 00:00:18,780 I think you'll find it worthwhile in your exploration phase. 6 00:00:18,780 --> 00:00:20,164 So let's open up build.gradle. 7 00:00:21,490 --> 00:00:23,320 And let's add this dependency. 8 00:00:23,320 --> 00:00:29,791 So we'll say, compile org.springframework.data. 9 00:00:29,791 --> 00:00:37,300 We'll do spring-data-rest-hal-browser. 10 00:00:37,300 --> 00:00:39,560 Not to be confused with that. 11 00:00:39,560 --> 00:00:42,296 Open the pod bay door cell. 12 00:00:42,296 --> 00:00:47,496 Okay, so we're gonna go over and 13 00:00:47,496 --> 00:00:50,850 refresh our gradle. 14 00:00:50,850 --> 00:00:52,820 Awesome, and then let's restart the server. 15 00:00:54,050 --> 00:00:54,572 Boom. 16 00:01:00,677 --> 00:01:05,233 And now if we go just to the root of our web page, what's gonna happen is, 17 00:01:05,233 --> 00:01:08,430 we're going to see a brand new browser. 18 00:01:08,430 --> 00:01:11,750 Now, this is super cool. 19 00:01:11,750 --> 00:01:16,060 So, what this allows us to do is, it's exploring those links, right? 20 00:01:16,060 --> 00:01:18,930 So, those underscore links that we were seeing before, this is what it's showing. 21 00:01:18,930 --> 00:01:22,739 And it's letting us just go ahead and navigate using HAL. 22 00:01:22,739 --> 00:01:25,466 So let's go ahead and let's look at, so see here reviews and 23 00:01:25,466 --> 00:01:28,450 reviews are over here in courses and courses over here. 24 00:01:28,450 --> 00:01:31,750 So if we go ahead and we do a get here, it will go ahead and 25 00:01:31,750 --> 00:01:34,510 help us specify what we wanna do. 26 00:01:34,510 --> 00:01:38,094 So we can say page 2 of courses and we want the page list to be 10 and 27 00:01:38,094 --> 00:01:41,241 you'll see that it's showing us what the URI is gonna do. 28 00:01:41,241 --> 00:01:45,660 If you click Follow URI, it will build that actual page up here. 29 00:01:45,660 --> 00:01:47,190 So here it is. 30 00:01:47,190 --> 00:01:50,590 Here's the response body and down here are the embedded courses. 31 00:01:50,590 --> 00:01:53,970 And if you go and you can click, you can open one of these up and 32 00:01:53,970 --> 00:01:56,190 you can go and look at the reviews for that. 33 00:01:56,190 --> 00:01:59,980 Let me look at the first review here and got a 3 and they wanted more spring and 34 00:01:59,980 --> 00:02:01,550 you can just click around it all, right? 35 00:02:03,290 --> 00:02:05,890 So if we go ahead, let's go back to the entry point here. 36 00:02:05,890 --> 00:02:06,580 Let's go to the front. 37 00:02:07,820 --> 00:02:10,500 And again the links that were provided here. 38 00:02:11,570 --> 00:02:14,430 So we were clicking get before to walk through this but 39 00:02:14,430 --> 00:02:16,370 we can also do non get requests ,right. 40 00:02:16,370 --> 00:02:17,540 So let's go ahead, let's add 1. 41 00:02:17,540 --> 00:02:19,160 Let's add a new thing here. 42 00:02:19,160 --> 00:02:21,140 So we'll perform a non-GET request. 43 00:02:22,840 --> 00:02:25,730 And look at this, it's using what we did, right? 44 00:02:25,730 --> 00:02:28,068 So we're creating a collection of online courses. 45 00:02:28,068 --> 00:02:28,782 Here is the title, 46 00:02:28,782 --> 00:02:31,694 here's the name of course, so it's using that meta data that we just put in. 47 00:02:31,694 --> 00:02:36,221 And it's automatically labeling the fields to be more descriptive for what it is. 48 00:02:36,221 --> 00:02:42,067 Pretty slick right, so let's go ahead let's do Java objects a look right there. 49 00:02:42,067 --> 00:02:46,224 And we will do library/java-objects. 50 00:02:46,224 --> 00:02:53,410 And we're gonna do a post and it is too small on this page to click unfortunately. 51 00:02:55,230 --> 00:02:59,370 Or let me see if I can, there we go, Make Request. 52 00:03:01,310 --> 00:03:04,820 Boom and it gave us a 201 created. 53 00:03:04,820 --> 00:03:08,180 So my favorite thing about this tool is that you can use it 54 00:03:08,180 --> 00:03:10,740 to expose clients writing software to your API. 55 00:03:10,740 --> 00:03:13,800 And they can learn how things work and what they need to do to get things up and 56 00:03:13,800 --> 00:03:15,790 running to use your API. 57 00:03:15,790 --> 00:03:18,180 I'm definitely gonna shoot this over to our team, right? 58 00:03:18,180 --> 00:03:19,440 This is awesome. 59 00:03:19,440 --> 00:03:22,310 So these tools, right, the postman and the HAL browser. 60 00:03:22,310 --> 00:03:25,740 There are good tools to use to verify that you have things working. 61 00:03:25,740 --> 00:03:30,519 And remember thus far, the only thing we really need to test is the spot check that 62 00:03:30,519 --> 00:03:33,844 we got things working like we think they should behave. 63 00:03:33,844 --> 00:03:38,606 We don't need to write any tests for any of this functionality because the spring 64 00:03:38,606 --> 00:03:41,950 data rest framework has its own set of tests. 65 00:03:41,950 --> 00:03:46,010 And just like the functionality wasn't our responsibility to write, 66 00:03:46,010 --> 00:03:49,090 testing that functionality isn't our responsibility either. 67 00:03:49,090 --> 00:03:51,290 So I'm glad you got a chance to check out a few of these tools. 68 00:03:51,290 --> 00:03:52,310 Check the teachers notes for more. 69 00:03:52,310 --> 00:03:54,820 Now that we have a couple easy ways of viewing and 70 00:03:54,820 --> 00:03:58,180 setting headers, let's go view a couple of features.