1 00:00:01,290 --> 00:00:03,660 We're all done with our update root handler. 2 00:00:03,690 --> 00:00:07,740 We've now got a lot of different routes inside of here and we've got some tests for each of them. 3 00:00:07,890 --> 00:00:12,360 But before we just say that everything is really complete I think could be kind of nice to test everything 4 00:00:12,360 --> 00:00:17,130 out using postmen to make sure that we can reach into this ticket service create a ticket updated ticket 5 00:00:17,160 --> 00:00:18,330 and so on. 6 00:00:18,440 --> 00:00:23,000 So we're going to use postman in this video to test out these different route handlers before we can 7 00:00:23,010 --> 00:00:27,050 however remember we have to expose access to this ticket service. 8 00:00:27,210 --> 00:00:33,450 We have not updated our ingress engine X config file and told it to take requests to API slash tickets 9 00:00:33,480 --> 00:00:39,590 and forward them onto our ticket service trying to find my info directory inside there I'll find Kate's 10 00:00:39,960 --> 00:00:42,100 ingress SRB. 11 00:00:42,210 --> 00:00:44,650 So here's our ingress config file. 12 00:00:44,720 --> 00:00:50,930 I'm gonna go down to our paths section and right after the API users path I'm going to add in a new 13 00:00:50,930 --> 00:01:01,010 path so we'll say any request to API slash tickets slash anything take the request and forward it onto 14 00:01:01,100 --> 00:01:02,380 this back end. 15 00:01:02,450 --> 00:01:11,230 I want to send it to the service with the name of tickets SRB and a service port of three thousand. 16 00:01:11,230 --> 00:01:17,440 Now once again it's super important that we add in this new path right here before the reactor the next 17 00:01:17,440 --> 00:01:21,310 JFK route handler or at real setting right here. 18 00:01:21,310 --> 00:01:26,440 This is a catch all route so if we put that at the top every single incoming request is always going 19 00:01:26,440 --> 00:01:30,410 to match that one first and we'll never get onto API users or API tickets. 20 00:01:31,490 --> 00:01:36,940 All right I'm going to save this file and then going to open up post man on my look machine. 21 00:01:38,090 --> 00:01:42,180 So here's postman right here and we're going to try to test out the different route handlers we've just 22 00:01:42,180 --> 00:01:44,320 put together to access all them. 23 00:01:44,340 --> 00:01:46,560 Remember we do have to be authenticated. 24 00:01:46,560 --> 00:01:51,540 The first thing I'm going to do is make a request to attempt to either sign in or sign up we'll do a 25 00:01:51,540 --> 00:01:57,970 post request to H2 G.P.S. ticketing Dev API users sign in. 26 00:01:58,140 --> 00:02:03,300 I'll go to Body select raw make sure I've got Jason selected over here and I could put in an email and 27 00:02:03,300 --> 00:02:08,700 password and remember if you're going to make a request to sign in the email password must be some combination 28 00:02:08,700 --> 00:02:12,880 that is valid that you've already created an account for on the off service. 29 00:02:12,990 --> 00:02:18,240 So if you do not remember any credentials you can always change it over to sign up and make a request 30 00:02:18,240 --> 00:02:20,850 to sign up at the email and password instead. 31 00:02:20,850 --> 00:02:25,520 Either way whether you sign up or sign in make sure you make that request and get a response back. 32 00:02:25,740 --> 00:02:30,750 As long as we see a response back that means we should now be authenticated just to confirm that we 33 00:02:30,750 --> 00:02:37,700 could open up a second tab make a get request to ticketing Dev API users current user and if we send 34 00:02:37,700 --> 00:02:42,170 that in we should see yes we are authenticated. 35 00:02:42,210 --> 00:02:42,460 All right. 36 00:02:42,470 --> 00:02:47,480 So now that I am authenticated First I am going to do is attempt to create a new ticket so I'll open 37 00:02:47,480 --> 00:02:49,010 up a third tab. 38 00:02:49,010 --> 00:02:59,620 I'm gonna make a post request to HTC P.S. ticketing Dev API tickets under the header section. 39 00:02:59,780 --> 00:03:11,550 I'm gonna put in a content type of application Jason will then go to the body tab select raw make sure 40 00:03:11,550 --> 00:03:16,920 I've got Jason selected and I will enter in the attributes or parameters body parameters that required 41 00:03:16,920 --> 00:03:21,070 to create a ticket which you'll recall is a title and a price. 42 00:03:21,220 --> 00:03:22,290 Don't put in a title 43 00:03:24,780 --> 00:03:25,410 concerts 44 00:03:28,110 --> 00:03:33,130 add a price of 10 remember that we are writing Jason on here. 45 00:03:33,170 --> 00:03:38,510 So the key is after you wrapped in double quotes and the word concert has to have double quotes as well. 46 00:03:38,530 --> 00:03:43,110 Then send this in and I should see a response that looks like this right here. 47 00:03:43,180 --> 00:03:46,170 I should have a status of two a one created and I should see the title. 48 00:03:46,240 --> 00:03:51,850 The price my user I.D. because on the person who owns this ticket and my I.D. for the ticket right there 49 00:03:51,850 --> 00:03:52,530 as well. 50 00:03:53,360 --> 00:03:55,440 Yeah well that definitely looks good. 51 00:03:55,440 --> 00:04:04,550 Now if we take that I.D. or copy it and I'm going to try to make a get request to API tickets flash 52 00:04:05,090 --> 00:04:05,810 and then that I.D. 53 00:04:09,750 --> 00:04:12,610 I'll then send that off and there we go. 54 00:04:12,620 --> 00:04:17,590 Requests made successfully status to 100 and I see all the details about that particular ticket. 55 00:04:19,040 --> 00:04:23,870 Let's try an official list of all of our tickets to do so we can delete that idea at the very end and 56 00:04:23,870 --> 00:04:30,090 make a request to just API slash tickets so I'll send that off and I should get back in array of all 57 00:04:30,090 --> 00:04:32,270 the different tickets that have been created in my case. 58 00:04:32,280 --> 00:04:36,610 I have to write here because I created one just before this video to test this out make sure everything 59 00:04:36,610 --> 00:04:41,730 was working correctly so you're probably going to see an array with just the ticket that you created. 60 00:04:43,050 --> 00:04:46,710 Now finally let's try to update this ticket that we just made a moment ago. 61 00:04:46,810 --> 00:04:47,990 It's going to take its idea. 62 00:04:47,990 --> 00:04:55,740 Once again I'm going to change the request type to a put I'll make the request to API tickets and then 63 00:04:55,740 --> 00:05:00,360 the I.D. then we could add in a new title and a new price. 64 00:05:00,370 --> 00:05:08,810 So for example I could put in a new title Love How about new concerts and a price of five hundred I'll 65 00:05:08,810 --> 00:05:11,390 make that request and there we go. 66 00:05:11,400 --> 00:05:16,050 I get a response back with the updated data and of course if you really want to test this we could try 67 00:05:16,050 --> 00:05:21,270 to fetch that ticket again so I can change this back to a get leave the euro all the same. 68 00:05:21,480 --> 00:05:24,960 That's the ticket and I'll see details about the one that I just updated. 69 00:05:24,980 --> 00:05:28,120 Yep looks like all that data was persisted successfully. 70 00:05:28,160 --> 00:05:28,400 OK. 71 00:05:28,440 --> 00:05:30,060 So overall I'd say this looks pretty good. 72 00:05:30,060 --> 00:05:32,040 I think that our ticket service is working. 73 00:05:33,210 --> 00:05:35,850 So let's take a quick pause right here and continue in just a moment.