1
00:00:00,330 --> 00:00:05,700
All right, and once our documentation makes sense to swagger, you are now the standout out in their

2
00:00:05,910 --> 00:00:13,350
online chatter, which is a nifty tool that we can use to test out our API docs right in the browser

3
00:00:13,740 --> 00:00:18,960
and if necessary, apply the changes and as a result, save ourselves a ton of time.

4
00:00:19,260 --> 00:00:26,370
So what I want you to do is go to your search engine and you're looking for swagger, Aitor or Swagger.

5
00:00:26,370 --> 00:00:28,280
You, IRA doesn't really matter.

6
00:00:28,650 --> 00:00:35,100
And then you can open up two tabs because you'll notice that they do provide some boilerplate code,

7
00:00:35,460 --> 00:00:40,110
which, of course, you can use in order to understand the entire setup.

8
00:00:40,470 --> 00:00:42,500
And this is exactly what I'm going to do.

9
00:00:42,660 --> 00:00:46,710
So I have one tab open and I'll open up the another one.

10
00:00:47,100 --> 00:00:50,760
And there I want to copy and paste this entire thing.

11
00:00:51,030 --> 00:00:52,260
So it selected.

12
00:00:53,160 --> 00:01:01,250
Then go back and I want to copy and paste after that, we can technically start testing our API, but

13
00:01:01,250 --> 00:01:09,470
the problem is that we still have the problems and fixed and also we have this extra bag.

14
00:01:09,800 --> 00:01:15,890
And I'll start with a tag where basically navigate to the bottom where you have the tags and just remove

15
00:01:15,890 --> 00:01:16,700
the first one.

16
00:01:17,270 --> 00:01:18,110
So that's done.

17
00:01:18,470 --> 00:01:24,710
And then let's deal with the query parameters, because if you take a look at our project, notice we

18
00:01:24,710 --> 00:01:29,530
have jobs online for single job, the update job and the job.

19
00:01:29,900 --> 00:01:35,580
These are query parameters, but at the moment everything is hardcoded.

20
00:01:35,960 --> 00:01:41,550
So how we can set it up in Swagga of Abram's well, we'll use their docs.

21
00:01:42,050 --> 00:01:49,160
This is going to be the case where I want you to again use your search engine and just type swagga UI

22
00:01:49,160 --> 00:01:51,510
parameters a quick out.

23
00:01:51,530 --> 00:01:57,170
If you can't be bothered going through the swagga docs, you can always find the correct code in the

24
00:01:57,170 --> 00:01:57,980
project readme.

25
00:01:58,370 --> 00:02:04,550
You're looking probably for the first link and we'll keep on scrolling up all the details on all of

26
00:02:04,550 --> 00:02:04,940
that.

27
00:02:05,390 --> 00:02:11,870
But what we're interested is common parameters for all methods of the path.

28
00:02:12,730 --> 00:02:19,090
Now, I don't want you to take the path part, but I want you to take everything, starting with the

29
00:02:19,090 --> 00:02:23,090
user all the way to get so take this code.

30
00:02:23,140 --> 00:02:24,240
Yes, we'll modify.

31
00:02:24,490 --> 00:02:27,420
But this is just going to be faster if we set it up this way.

32
00:02:27,850 --> 00:02:33,070
Go back to your error and what you're looking for are those single roots.

33
00:02:33,370 --> 00:02:38,930
So go up here where you have the patch, remove the hardcoded one, including the column.

34
00:02:38,950 --> 00:02:42,160
This is very, very important and the same forget.

35
00:02:42,520 --> 00:02:47,200
And once you remove the part, just copy and paste of this one.

36
00:02:47,440 --> 00:02:52,450
In this case, we don't want to use the user because the root is jobs.

37
00:02:52,450 --> 00:02:52,870
Correct.

38
00:02:53,180 --> 00:02:59,620
Then we have the area that still stays the same and that of integer is going to be a string.

39
00:02:59,830 --> 00:03:03,220
It's going to be required and it's going to be a job.

40
00:03:03,640 --> 00:03:08,560
Again, if you want to find more info, please just read their documentation part.

41
00:03:08,560 --> 00:03:12,090
Essentially, what we did right now, we added that I.

42
00:03:12,100 --> 00:03:19,900
D parameter in all these three routes, that single job update job and the Leitrim and ones, we have

43
00:03:19,900 --> 00:03:21,010
this in place now.

44
00:03:21,010 --> 00:03:25,840
We can start testing our API and start by registering the user.

45
00:03:26,020 --> 00:03:31,030
Now, I'm not going to try out all the routes, but I think I'm just going to go with a register and

46
00:03:31,030 --> 00:03:36,490
maybe I'll try to create the job and then take a look at a single job just so I can see that everything

47
00:03:36,490 --> 00:03:36,850
works.

48
00:03:37,330 --> 00:03:41,530
And the way we do that in a swagga we look for try it out here.

49
00:03:41,750 --> 00:03:44,080
Notice these are the values that we're sending.

50
00:03:44,230 --> 00:03:48,340
And of course, once you already registered user, you'll have to change these values around.

51
00:03:48,340 --> 00:03:53,230
But in my case, I deleted the bob from my database so I can execute.

52
00:03:53,590 --> 00:03:57,280
Now, this is going to be the sample request.

53
00:03:57,570 --> 00:03:59,260
This is going to be the ๓rale.

54
00:03:59,530 --> 00:04:01,750
And, well, this is the response.

55
00:04:01,990 --> 00:04:03,280
So that's my token.

56
00:04:03,640 --> 00:04:10,420
But the deal again in here is that if these ones are protected, so if I'll just try to access the job

57
00:04:10,420 --> 00:04:13,980
or create job or whatever, I'm not going to be able to do that.

58
00:04:14,230 --> 00:04:18,700
So you want a copy of the token and you have two options.

59
00:04:18,940 --> 00:04:24,010
Either you can set up in one of them and automatically it's going to be added to all of them.

60
00:04:24,340 --> 00:04:29,330
Or you can just scroll up and same deal, just copy and paste the value authorized.

61
00:04:30,040 --> 00:04:34,180
So now I set up my token so I can close the register.

62
00:04:34,330 --> 00:04:35,230
I'm good to go.

63
00:04:35,440 --> 00:04:37,030
Now we just want to create the job.

64
00:04:37,270 --> 00:04:39,310
So let's go to the post request.

65
00:04:39,820 --> 00:04:41,500
Can we're trying it out.

66
00:04:41,740 --> 00:04:49,690
I'm going to go with the same Google and the front end developer will execute and we should get back

67
00:04:49,690 --> 00:04:51,430
the job of the two on one.

68
00:04:51,790 --> 00:04:57,570
And now if I go to get all jobs and we try it out, we just execute.

69
00:04:57,580 --> 00:04:58,900
We don't need to provide anything.

70
00:04:59,020 --> 00:05:02,680
We have our jobs right with a count of one.

71
00:05:02,980 --> 00:05:07,990
And if I want to take a look at single job, we want to copy and paste the value.

72
00:05:08,530 --> 00:05:13,030
And as far as the set up, either of these is going to work.

73
00:05:13,040 --> 00:05:15,490
So either get the patch or delete.

74
00:05:15,730 --> 00:05:19,450
And Mike, I think I'm going to go get we want to try it out again.

75
00:05:19,480 --> 00:05:21,360
After that, we want to pace the job.

76
00:05:21,730 --> 00:05:27,670
Remember, as far as the authorization we write away, sort of token at the very, very start.

77
00:05:27,910 --> 00:05:31,270
So now, of course, we're authorized to make these requests.

78
00:05:31,600 --> 00:05:34,270
So once we execute, check it out.

79
00:05:34,630 --> 00:05:43,000
Now I can see my one job and once everything is working now, the last step is just setting this up

80
00:05:43,240 --> 00:05:44,380
in our application.

81
00:05:44,500 --> 00:05:48,250
So we'll still need this code, but remove it or mess it up.

82
00:05:48,580 --> 00:05:51,760
But the good news is that we're pretty much done with the hardest part.

83
00:05:52,180 --> 00:05:56,080
So I promise it's going to be a smooth sailing from here on out.

