WEBVTT

00:03.820 --> 00:05.410
Hey there, everyone that they share.

00:05.410 --> 00:10.390
And from this video onwards, I will be skipping the information about explaining about the tags, what

00:10.390 --> 00:12.210
summary does, what responses does.

00:12.220 --> 00:15.850
Of course, everything, anything that new comes in like we have just seen the responses.

00:15.850 --> 00:18.670
We haven't seen about the request and a whole bunch of headers.

00:18.670 --> 00:21.430
So I'll explain those, but I won't be repeating this again.

00:21.430 --> 00:24.720
So in case you are jumping around in the videos, you will find it difficult.

00:24.720 --> 00:29.680
So follow the path and the flow of the course in case somebody else is jumping around and having an

00:29.680 --> 00:30.850
issue in the comment section.

00:30.850 --> 00:34.240
Don't forget to notify him that you have skipped the videos.

00:34.240 --> 00:36.400
That's why it is creating an issue for you.

00:36.670 --> 00:38.050
Okay, so let's move on now.

00:38.050 --> 00:42.520
In the next one, we are going to take down first and foremost, one thing that is bothering us quite

00:42.520 --> 00:45.220
a lot is we need to select all these things again.

00:45.220 --> 00:46.900
Again, we need to do something about it.

00:46.900 --> 00:48.430
We need to provide the default.

00:48.430 --> 00:49.870
So how do we provide default?

00:49.870 --> 00:52.360
It is like couldn't be much more easier than this.

00:52.360 --> 00:56.860
Once you have defined the enum, it actually goes into the same indentation level as enum.

00:56.860 --> 01:00.910
So let's go up here and all you got to do is simply name the default whatever you want to go.

01:00.910 --> 01:05.980
In this case, I want to go for V one because we are working on the version one and same thing goes

01:05.980 --> 01:06.490
up here.

01:06.490 --> 01:08.830
I'm going to go ahead and say default.

01:08.830 --> 01:12.520
And in my case it is HTTP only, not the https.

01:12.520 --> 01:16.970
Once I do this, I go back up here, hit the reload and I can notice my computer.

01:16.970 --> 01:22.720
The URL is now http, but still I have my enemies that if I want to I can go ahead and change them.

01:22.720 --> 01:24.820
So this solves our one issue.

01:24.880 --> 01:25.990
So that is great.

01:25.990 --> 01:32.380
Now let's go back into the index case and what I will do now is I'll grab a copy of this one.

01:32.380 --> 01:35.800
So let's go ahead and grab this one and there we go.

01:36.400 --> 01:39.190
Now this time we want to have an AE object.

01:39.190 --> 01:43.600
So we'll study about how, when objects are returned, how we can write schema for that and how the

01:43.600 --> 01:45.370
response actually should look like.

01:45.370 --> 01:49.990
So for this one, we are going to send a response and again, you can go ahead and use the resort JSON

01:49.990 --> 01:51.550
in case you want to really send that.

01:51.550 --> 01:53.710
I leave that as a simple exercise for you.

01:53.710 --> 01:56.530
So in this case, we are going to just remove all of this.

01:56.530 --> 01:59.050
Instead, I'll send a JSON like this.

01:59.140 --> 02:02.080
I know we can use the courses that we have created.

02:02.080 --> 02:05.170
We can send a first value or the second value of it.

02:05.200 --> 02:06.070
We will use that.

02:06.070 --> 02:06.940
Don't worry on that.

02:06.940 --> 02:10.420
But this time we'll be going up and we'll be saying something like this.

02:10.420 --> 02:15.610
So manually insert all the values name is going to be something like Learn Back End.

02:15.610 --> 02:17.560
That's exactly what you are doing right now.

02:18.130 --> 02:22.420
And let's go ahead and add the final one, which is going to be price, which let's just say is nine,

02:22.420 --> 02:23.170
nine, nine.

02:23.500 --> 02:23.890
Okay.

02:23.950 --> 02:28.210
So this is the route that we have and we have to write the documentation for this one.

02:28.240 --> 02:33.310
Now, usually what you will be doing in this case is first, make sure you always close these guys,

02:33.310 --> 02:35.710
otherwise they will be too much of a big file.

02:35.830 --> 02:40.570
Now you can also go ahead and close this from any of the point like get and all of that.

02:40.570 --> 02:43.480
Now this is a completely different path that we're having.

02:43.540 --> 02:48.190
Make sure one thing you always understand that if you're creating a new path, you come back up here,

02:48.190 --> 02:50.680
you have to write that on the same indentation up here.

02:50.680 --> 02:52.240
So all of this goes up here.

02:52.240 --> 02:54.970
As soon as I hit the tab, notice it's going all the way crazy.

02:54.970 --> 02:59.590
So sometimes you have to keep track of how many spaces or tabs you are giving and then start writing

02:59.590 --> 03:00.130
the new path.

03:00.130 --> 03:06.370
Like I have to write the AE object just here, otherwise it's going to go all crazy.

03:06.370 --> 03:11.890
Now one of the thing that I absolutely love is the skills of copy pasting and the keyboard shortcuts,

03:11.890 --> 03:17.470
so I can go ahead and select all of this because this is all kind of exactly in most of the request.

03:17.470 --> 03:21.100
You are going to need some or the other form of this exact same structure.

03:21.100 --> 03:23.200
So I go ahead and get a copy of it.

03:23.200 --> 03:25.810
It somehow maintains my indentation level.

03:25.810 --> 03:30.790
The errors are because it doesn't allow the repetition of the same path with the same values.

03:30.790 --> 03:33.610
So I have to go ahead and say ae object.

03:33.610 --> 03:37.960
Now this is all happy, but I can have one more space up here.

03:37.990 --> 03:39.430
Notice it messed it up again.

03:39.430 --> 03:41.530
So I need to make sure that this is all good.

03:41.740 --> 03:47.440
So as soon as I saved this, and by doing only this much, you will now understand that what this tags

03:47.440 --> 03:48.280
actually mean.

03:48.280 --> 03:50.200
So I go back up here, hit a reload.

03:51.010 --> 03:54.910
Now notice all of them are actually under the category of the strings.

03:54.910 --> 03:56.710
That's all because of the tags.

03:56.710 --> 03:58.660
Now, this is not a string.

03:58.660 --> 03:59.950
This is more about objects.

03:59.950 --> 04:04.150
So I'll create a new category for this by defining a new tag, which is object.

04:04.150 --> 04:05.950
And I can go ahead and hit reload.

04:05.950 --> 04:10.000
And now you can see that I have a string category and I have this object category.

04:10.000 --> 04:15.490
So you can define, let's just say all the products under this category, all the roots, four categories,

04:15.850 --> 04:20.230
maybe stocks or different payment routes, all in one category.

04:20.230 --> 04:22.480
This actually makes life a little bit easier.

04:22.510 --> 04:24.610
Not too much, but of course, a little bit.

04:24.760 --> 04:26.470
Okay, moving on.

04:26.470 --> 04:28.810
Now that you understand this, one returns.

04:30.360 --> 04:34.620
Returns a unique course.

04:35.070 --> 04:36.220
Yeah, that's fine.

04:36.240 --> 04:38.310
Now we can see that we have responses again.

04:38.310 --> 04:41.130
We can work similarly, like we have worked on 200.

04:41.130 --> 04:44.570
We can work on 405 hundred and you can copy paste that.

04:44.580 --> 04:45.690
I won't be doing that.

04:45.690 --> 04:46.410
I'll show you that.

04:46.410 --> 04:48.120
What is the difference between up here?

04:48.120 --> 04:50.520
So description is all good content.

04:50.520 --> 04:52.890
We will be still getting an application json.

04:52.890 --> 04:57.780
The schema changes a little bit because this is now not a string but an object that will be coming up

04:57.780 --> 05:00.090
and it supports string object arrays.

05:00.090 --> 05:01.470
We'll see them later on.

05:01.470 --> 05:03.870
But now this example cannot be like this.

05:03.870 --> 05:04.980
It can be different.

05:05.130 --> 05:11.400
I will not be giving an example in the case of objects, but rather I would like to show the scheme

05:11.820 --> 05:14.010
that how it looks like, like schema in that scheme.

05:14.010 --> 05:15.270
So there we go.

05:15.270 --> 05:19.020
Now make sure you hit once we have this object type up here.

05:19.020 --> 05:21.750
So let's go ahead and define the properties.

05:22.290 --> 05:28.830
Now one thing to note down properties only come when there is a type of object, otherwise it doesn't

05:28.830 --> 05:29.070
come.

05:29.070 --> 05:35.730
This is specifically related to object because let me show you that this is an object.

05:35.730 --> 05:38.580
So notice here and the line number 38, this is an object.

05:38.610 --> 05:44.430
Now inside each object, there are properties and these key value pairs together are known as properties.

05:44.430 --> 05:46.410
And this property has a key and a value.

05:46.410 --> 05:49.050
That's why we call them so quite interesting one.

05:49.740 --> 05:55.530
Okay, so how this is going to look like it will show us an ID and let's go ahead and define what is

05:55.530 --> 05:56.700
going to be type of this one.

05:56.700 --> 05:58.470
In this case, this is going to be a string.

05:58.590 --> 06:00.270
We'll receive another one.

06:00.390 --> 06:03.240
Let's call this one as name because that's what's coming in.

06:03.240 --> 06:07.020
And let's also define the type of it which is also a string.

06:07.230 --> 06:10.140
And there's another one which is coming up is price.

06:10.560 --> 06:11.610
And there we go.

06:11.640 --> 06:14.820
The type is going to be further string.

06:14.820 --> 06:20.460
Now, if there is also an object coming up inside an object, so you can go ahead and define something

06:20.460 --> 06:22.590
like something.

06:22.590 --> 06:25.200
I'm running out of the name, so let's call it this cause again.

06:25.200 --> 06:31.260
Then it can have a type of object and then you can go ahead and define properties again.

06:31.260 --> 06:36.630
You get the idea what I'm trying to explain up here, I'm going to go ahead and remove these three guys.

06:36.630 --> 06:39.600
Let's go ahead and save this.

06:39.600 --> 06:42.210
Let's go back on to this one and hit a reload.

06:42.450 --> 06:43.800
And now we have this object.

06:43.800 --> 06:46.290
Let's expand this one and understand this one.

06:46.290 --> 06:48.720
This is going to request a LC object.

06:48.720 --> 06:51.030
Let's go ahead and try this out and execute.

06:51.270 --> 06:55.500
And this gives us the response body as whatever we have sent it up here.

06:55.500 --> 07:01.350
But if I go ahead and cancel this out and let me just try to hit a reload up here one more time.

07:02.090 --> 07:06.350
Now notice here that it says that this is how the example value will come up.

07:06.350 --> 07:11.060
So automatically it fills it up that you will receive an object which will have these key value pairs,

07:11.060 --> 07:13.040
ID name and price as being defined.

07:13.040 --> 07:15.290
But you can also go ahead and click on schema.

07:15.470 --> 07:19.220
Usually nobody does because it is already mentioned up there, so it's pretty obvious.

07:19.220 --> 07:24.320
But you can see that the ID is of type string, the name is of type string and the price is also type

07:24.320 --> 07:26.720
of string, which should be a number.

07:26.750 --> 07:27.320
Yep.

07:28.070 --> 07:30.200
So let's go ahead and change that as a number.

07:30.500 --> 07:30.800
Okay.

07:30.800 --> 07:32.810
Let's go ahead and hit reload one more time.

07:32.810 --> 07:37.490
And now we can see that Price is zero and I click on schema and notice it's a number.

07:37.490 --> 07:42.410
Now similarly, you can work on the bad request that if the bad request will happen, what kind of error

07:42.410 --> 07:43.550
response you'll be getting?

07:43.550 --> 07:48.200
Either it's going to be response, the data dot message dot something, or it's going to be just a string.

07:48.200 --> 07:53.690
You can define all of these parameters up here and now at this point you understand that how the default

07:53.690 --> 07:56.630
values can be set up as well as different tags are being used.

07:56.630 --> 07:58.990
And how you can define an object up here.

07:59.000 --> 08:00.380
Told you it's really simple.

08:00.380 --> 08:04.820
Let's keep the video short and in the next video we're going to see that how we can handle arrays.

08:04.820 --> 08:06.770
Let's go ahead and move on in the next video.
