1 00:00:11,970 --> 00:00:17,580 Hello and welcome to the goal and programming language course in the penalty session. 2 00:00:17,820 --> 00:00:26,190 We were able to implement the rest functions and now it's time to implement the configurations related 3 00:00:26,190 --> 00:00:27,510 to rest API. 4 00:00:28,080 --> 00:00:36,660 So go to Project Folder and go to rest layer and create a go link file named like risk config. 5 00:00:40,710 --> 00:00:42,210 So go to rest layer. 6 00:00:43,980 --> 00:00:48,840 Create a new file like rest config, 7 00:00:52,200 --> 00:00:56,370 first package name package rest layer. 8 00:00:57,690 --> 00:01:05,730 First, we create and implements a method that is responsible for create different reporters to respond 9 00:01:05,730 --> 00:01:09,090 to different U R L requests or end points. 10 00:01:10,460 --> 00:01:18,350 So create a method name like race feek, this function ads that are water objects from Musk's package 11 00:01:18,350 --> 00:01:19,850 as input parameter. 12 00:01:19,860 --> 00:01:22,070 So we right find. 13 00:01:25,060 --> 00:01:28,420 Rest, calm feet 14 00:01:31,780 --> 00:01:37,030 and sit rotor as parameter from pole to love locks 15 00:01:39,370 --> 00:01:39,970 rotor. 16 00:01:47,400 --> 00:01:56,910 Relata registers roads to be matched and dispatches the handler, it implements the ITBP handler interface 17 00:01:57,210 --> 00:02:00,810 so it can be registered to serve requests. 18 00:02:01,620 --> 00:02:10,800 Now we want to define an end point as per fix or a fixed value that exists in all and points for rest. 19 00:02:11,580 --> 00:02:18,360 So from the rotor object, we call the get perfect method and set our fixed end point in it. 20 00:02:18,630 --> 00:02:22,530 So first, define the variable light rare throughout our wrist. 21 00:02:23,100 --> 00:02:37,500 Lauter call it equals from rotor object calling pass per fix function, rotor dart pass per fix function. 22 00:02:38,250 --> 00:02:48,750 For example, we said it's less risk if this API, as fixed endpoint in all requests sits, is less 23 00:02:48,750 --> 00:02:49,380 rest. 24 00:02:49,890 --> 00:03:03,810 This last API and then calling SOP rotor function dot sop rotor stop rotor function creates a somber 25 00:03:03,810 --> 00:03:05,130 rotor for the road. 26 00:03:05,730 --> 00:03:13,410 It will test the inner roads only if the parents route matched, so we were able to define a common 27 00:03:13,410 --> 00:03:16,530 end point as a perfect for our requests. 28 00:03:18,660 --> 00:03:21,240 Now we want to create different endpoints. 29 00:03:21,930 --> 00:03:28,800 Suppose we want to return all the students of this student table from person database by calling in 30 00:03:28,800 --> 00:03:30,180 and point of view on it. 31 00:03:30,690 --> 00:03:38,970 To do this, we do the following current methods function from the created resource rotor for set type 32 00:03:38,970 --> 00:03:45,510 of requests, methods, function registers and new role within a matter for ESTEP methods. 33 00:03:45,930 --> 00:03:51,090 In this case, we want to use yet requested sore right 34 00:03:54,000 --> 00:03:55,740 wrist rotor. 35 00:04:00,590 --> 00:04:01,390 Net methods. 36 00:04:04,470 --> 00:04:12,270 And so it gets as a request site and calling pass function, pat function. 37 00:04:12,600 --> 00:04:18,570 That's a matter for the U.S. to pat it, accept a template with zero or more. 38 00:04:18,780 --> 00:04:21,630 You are all variables enclosed by credit braces. 39 00:04:22,710 --> 00:04:28,860 The template must start with the restless and variable names must be unique in a given route. 40 00:04:29,310 --> 00:04:36,090 In this case for which all the students we set that Pat's like as a student, so we write Dot. 41 00:04:39,990 --> 00:04:42,420 And since it's less students. 42 00:04:47,340 --> 00:04:59,490 And then calling handler function dog handler function, this function sets a handler function for the. 43 00:05:00,420 --> 00:05:08,010 Now we need to give a function handler as a parameter to dismantle and see what is going to do for us. 44 00:05:09,330 --> 00:05:14,610 Now, Paul's a functional handler from a rest function, fine as arguments in this case. 45 00:05:14,760 --> 00:05:24,100 We want to focus on students, so be in books, select all students function, select all students function. 46 00:05:25,620 --> 00:05:32,580 So we were able to create an end point to fetch all the students from a student table of the person 47 00:05:32,820 --> 00:05:33,540 database. 48 00:05:36,020 --> 00:05:43,400 Now we create another employee to first a student based name from the database to do this. 49 00:05:43,670 --> 00:05:53,630 We do the following culling methods function from the created wrist rotor faucet type of request wrist 50 00:05:54,380 --> 00:05:57,140 rotor dots methods 51 00:05:59,660 --> 00:06:04,940 type of the request in these cases get sit packed 52 00:06:08,120 --> 00:06:11,660 in this case for a student base its name. 53 00:06:12,020 --> 00:06:19,110 Set apart like SLAC student slash caliber SS and set the name name variable as parameter. 54 00:06:20,210 --> 00:06:33,050 So the right list student slash curly braces sit a variable ask parameter, for example. 55 00:06:33,050 --> 00:06:34,400 In this case, we sit name. 56 00:06:38,270 --> 00:06:41,360 And calling handler function. 57 00:06:45,970 --> 00:06:52,660 In this case, we want to fit a student base its name solving would select a student based name function 58 00:06:52,870 --> 00:06:58,780 as handler function, select a student base name. 59 00:06:59,950 --> 00:07:06,430 So we were able to create a named point to fit a student base its name from a student table of the person 60 00:07:06,700 --> 00:07:07,450 database. 61 00:07:08,260 --> 00:07:15,580 Now create another end point, for example, to seven new student into person database, so go to the 62 00:07:15,580 --> 00:07:22,000 next line calling method function from restful to this role to what methods? 63 00:07:26,180 --> 00:07:31,610 In this case, we want to use post as requested and calling pant function. 64 00:07:32,510 --> 00:07:40,370 So we write post as request type and calling pad function. 65 00:07:42,680 --> 00:07:44,750 We want to insert a new Sudan. 66 00:07:44,750 --> 00:07:48,380 So we said the part like that special student, a class act. 67 00:07:49,280 --> 00:07:50,840 It's less student. 68 00:07:51,200 --> 00:07:56,120 It's less act and cutting handle the function. 69 00:08:00,350 --> 00:08:03,120 We need to give a function handed as a parameter. 70 00:08:03,500 --> 00:08:14,350 In this case, we want to save a new student so we can save a student function, save the student function. 71 00:08:17,210 --> 00:08:20,750 So we were able to create an endpoint to save in the student. 72 00:08:21,320 --> 00:08:28,310 And now we want to create another endpoint to update existing student into a person database. 73 00:08:29,180 --> 00:08:33,860 So calling methods function from this role to their slaughter. 74 00:08:36,770 --> 00:08:37,760 NATO's function 75 00:08:40,640 --> 00:08:49,730 and in this case, we use from post as a request type post calling pad function. 76 00:08:53,830 --> 00:09:00,190 We want to update in New Sudan, so we said that Pat Riley is such a student, this last edit is less 77 00:09:00,550 --> 00:09:06,340 students, is less headed and invoke have their function. 78 00:09:10,160 --> 00:09:17,360 In this case, we want to update annexes to Sudan, so we won't update is to then function from rest 79 00:09:17,510 --> 00:09:26,240 functions, update students, OK, the format, the code and save the project. 80 00:09:26,600 --> 00:09:35,420 Now we were able to implement the rest config methods to create different rotors like save, update 81 00:09:35,420 --> 00:09:36,530 and select. 82 00:09:38,890 --> 00:09:44,110 In order not to prolong the time of decision, we will finish it and we will continue to contend in 83 00:09:44,110 --> 00:09:44,980 the next session. 84 00:09:45,160 --> 00:09:45,730 Goodbye.