WEBVTT

00:03.760 --> 00:09.250
Hey, did everyone at Asia and I know we have studied a lot of theory, but this is all important and

00:09.250 --> 00:12.220
now it's time that we proceed further into our application.

00:12.220 --> 00:13.320
So how are we going to do this?

00:13.330 --> 00:17.980
We have already our board ready and now we understand a whole lot about this diagram that we initially

00:17.980 --> 00:22.030
created, the route we know that gate requests are there on the gate.

00:22.120 --> 00:27.820
We will be saying slash local host, port number, whatever that is, slash API, slash Instagram.

00:27.820 --> 00:32.500
Now here's my small tip that I would like to recommend you for the production grade application.

00:32.500 --> 00:36.610
In the usual case, you are going to see that people actually don't write it like slash API.

00:36.640 --> 00:40.990
They go ahead and simply say Slash, V one and slash, what is this one?

00:40.990 --> 00:43.300
The Suivent is the version one of the API.

00:43.330 --> 00:47.320
Eventually, as you saw in the Express, that sometimes there are drastic changes that you want to do

00:47.320 --> 00:52.330
in the application and they go ahead and change all of this like they are moving from two to 3 to 4

00:52.330 --> 00:53.830
and now they are moving on to five.

00:53.860 --> 00:57.730
So any application that you are building up that should also support that.

00:57.730 --> 01:02.830
And if you are planning to support the legacy or the old users, then obviously this is one of the great

01:02.830 --> 01:03.910
idea that you can have.

01:03.910 --> 01:05.200
Now this should be consistent.

01:05.200 --> 01:08.710
So in case you are going for this, then there should be av1 everywhere.

01:08.710 --> 01:15.250
So we'll be using something like V one for Facebook just like this and obviously the V one for the LinkedIn

01:15.250 --> 01:15.580
as well.

01:15.580 --> 01:17.590
So let's go ahead and change this route.

01:17.590 --> 01:22.870
Again, this is not really compulsory, but these are all things usually come from your supervisor,

01:22.870 --> 01:27.430
your managers or some senior developers that what routes we are going to be following and how you're

01:27.430 --> 01:32.080
are going to be working determination of what you are going to call your methods and determination of

01:32.080 --> 01:35.260
what you are going to call your routes usually is the job of senior developers.

01:35.260 --> 01:36.730
They do it very well.

01:36.730 --> 01:41.440
But again, if in case you want to know that this is all it, we are going to take care of these three

01:41.440 --> 01:42.010
things.

01:42.010 --> 01:43.000
Greetings, home route.

01:43.000 --> 01:44.560
We have already taken care of that.

01:44.560 --> 01:47.920
Now here we need to create some of the JSON data this time.

01:47.920 --> 01:54.040
So this one API, Instagram, Facebook and LinkedIn will be doing in this video maturity hopefully and

01:54.040 --> 01:55.600
this one will take care of the later one.

01:55.600 --> 01:57.850
Right now these three are our goal.

01:58.900 --> 01:59.620
Moving on.

01:59.620 --> 02:01.660
This route is all happy and all good.

02:01.660 --> 02:03.160
I wouldn't be touching it further.

02:03.160 --> 02:05.380
Let's go ahead and get more root.

02:05.380 --> 02:06.340
The process is same.

02:06.340 --> 02:12.970
We simply say that this will be a get request and what will be root so slash API slash V one.

02:12.970 --> 02:16.450
And then we are going to say starting with of course, Instagram.

02:16.660 --> 02:19.180
So Instagram, that's nice.

02:19.180 --> 02:19.680
Okay.

02:19.780 --> 02:23.830
And then we're going to say that you send me some request, I'll get you some response.

02:23.830 --> 02:26.320
Both are available to me thanks to Express.

02:26.320 --> 02:29.020
And we're going to go like this now.

02:29.020 --> 02:30.880
We're going to simply say a response.

02:30.880 --> 02:34.360
But before we create a response, let's go ahead and create a social object.

02:34.360 --> 02:36.130
So let's go ahead and classic JavaScript.

02:36.130 --> 02:39.490
We call it as insta social.

02:39.490 --> 02:40.960
This is just a ordinary variable.

02:40.960 --> 02:44.920
It will have some of the object values and this is an object.

02:44.920 --> 02:46.660
So this can act as a JSON.

02:46.660 --> 02:52.090
Now after that, we're going to simply say rez dot status because we are sending somebody something.

02:52.090 --> 02:57.130
So let's go ahead and call it as 200 and then we are going to go ahead and simply send that.

02:57.160 --> 02:59.950
Now, should I send it directly like that?

02:59.950 --> 03:01.000
Probably not.

03:01.000 --> 03:04.720
Let's go ahead and look into the documentation because we want to send some JSON response.

03:04.720 --> 03:05.410
This time.

03:05.500 --> 03:08.440
Let's go into the API guide and we want to go for response.

03:08.440 --> 03:14.170
And we saw that there is a JSON and I can use a restart JSON and can send the JSON object just like

03:14.170 --> 03:15.220
this key value pair.

03:15.220 --> 03:15.640
Awesome.

03:15.640 --> 03:17.080
This is exactly what I want.

03:17.080 --> 03:21.130
So I'm going to go ahead and say that this time instead of the send, I'm going to go ahead and send

03:21.130 --> 03:22.240
you a JSON.

03:22.240 --> 03:25.270
And in the JSON, I'm going to just add an install social.

03:25.270 --> 03:31.630
I can go ahead and write this just like this and say this is going to be my key, this is going to be

03:31.630 --> 03:34.180
my value, something like this, but I don't want to do this.

03:34.180 --> 03:36.490
Instead, I would love to pass on an object.

03:36.490 --> 03:38.320
It would be easier for me.

03:38.560 --> 03:42.610
So what are the three things that user is requesting from me?

03:42.640 --> 03:46.960
User requesting that you need to give me a username, so let's give it a username.

03:46.960 --> 03:47.500
Of course.

03:47.500 --> 03:48.790
Mine username.

03:50.140 --> 03:50.800
There we go.

03:50.800 --> 03:59.140
Pretty long one and then let's pass on some of the followers and probably I have, let's just say 66

03:59.140 --> 04:06.370
followers on Instagram and then we are going to say followers and what are the structure you need to

04:06.370 --> 04:06.790
define?

04:06.790 --> 04:08.140
You can go ahead and define that.

04:08.140 --> 04:11.050
Ideally, I would be creating a model and all of that.

04:11.050 --> 04:13.870
But wait a minute, this is just getting started.

04:13.870 --> 04:15.070
We will do that, all of it.

04:15.190 --> 04:17.140
And probably I'm following a whole lot of people.

04:17.140 --> 04:22.750
I follow a lot of people on Instagram, probably like 70 people or something, and we haven't talked

04:22.750 --> 04:24.010
yet about the date.

04:24.010 --> 04:28.330
But one thing we still can do is let's just go ahead and say date and I can say date.

04:28.600 --> 04:33.670
Now this is not going to be looking very elegant or good, but at least we'll have something.

04:33.760 --> 04:36.550
Okay, so this is all the data that we have.

04:36.580 --> 04:38.860
As soon as I save this, the server is up and running.

04:38.860 --> 04:43.330
Now another route is ready, which is slash API, slash V1, slash Instagram.

04:43.450 --> 04:47.830
The place to test it up obviously is postman not on the web browser.

04:47.830 --> 04:50.140
So let's go ahead and work on with that.

04:50.140 --> 04:55.030
So we'll be saying that, hey, I want to go ahead and use this one and make sure you are not using

04:55.030 --> 04:56.140
extra slashes.

04:56.140 --> 04:57.310
Be very cautious.

04:57.460 --> 05:00.940
So localhost api v one instagram get request.

05:00.940 --> 05:01.570
Absolutely.

05:01.570 --> 05:01.870
Fine.

05:02.020 --> 05:05.620
Don't need to care about params authorization or anything else at all.

05:05.740 --> 05:08.140
Let's go ahead and hit the send and there we go.

05:08.140 --> 05:13.960
Now we are receiving a status quo 200 and we are receiving an install social and object, which is an

05:13.960 --> 05:14.470
object.

05:14.470 --> 05:16.660
And you can find information further down.

05:16.660 --> 05:21.190
If you want to directly send this information, you can just cut and paste that.

05:21.190 --> 05:23.290
I'm pretty sure you are pretty much familiar with that.

05:23.410 --> 05:29.170
What I mean to say by that, you can actually go ahead and copy this entire response and instead of

05:29.170 --> 05:35.650
this instance social, I can just go ahead and remove this and can pass it on like that.

05:36.040 --> 05:42.070
When I do so and I make a request like this, it just gives me a direct object with all the values.

05:42.070 --> 05:44.320
Depends on how you want to follow up.

05:44.500 --> 05:45.760
This is totally up to you.

05:45.760 --> 05:50.560
I'm going to go ahead and say that I want to have a JSON which is just install social.

05:50.680 --> 05:55.960
Now, can I do like this just as I save this?

05:56.080 --> 05:57.040
Can I do this?

05:57.040 --> 05:58.600
Yes, of course you can do this.

05:58.900 --> 06:01.990
You are totally allowed to do this and you'll get the same result.

06:01.990 --> 06:02.770
Did I save this?

06:02.770 --> 06:03.310
Yep.

06:03.790 --> 06:05.740
This time we are passing on the variable.

06:05.740 --> 06:08.860
So all this is directly going in previously?

06:08.860 --> 06:09.310
I don't know.

06:09.310 --> 06:12.150
Somehow my editor added an extra curly braces.

06:12.160 --> 06:15.550
Didn't want it that okay, this is all good.

06:15.550 --> 06:19.990
So now what we need to do further down the road is just need to copy and paste.

06:19.990 --> 06:24.880
I know this is not too good for the experienced developer, but we are beginners here.

06:25.090 --> 06:28.120
So now we have get on the Facebook.

06:28.120 --> 06:34.360
So let's go ahead and say somebody request a Facebook, I'll give him my Facebook ID, which is page

06:34.900 --> 06:35.710
somehow.

06:35.920 --> 06:38.740
And I have no idea how many followers I have on Facebook.

06:38.740 --> 06:41.620
It's been long that I have opened it up, probably 88.

06:41.950 --> 06:43.150
And how many people I follow?

06:43.150 --> 06:44.410
I have no idea.

06:44.410 --> 06:46.530
Ten date will be day dot.

06:46.540 --> 06:55.780
Now for LinkedIn that I know LinkedIn and I have a username of I guess just hit a shot right there.

06:55.780 --> 07:04.090
Not sure and followers I guess I'm on to some somewhat like a 200 though.

07:04.090 --> 07:04.420
I don't know.

07:04.420 --> 07:05.170
Precisely.

07:05.320 --> 07:06.770
Okay, 80 and 80.

07:06.790 --> 07:09.100
Now let's go ahead and check out all the routes.

07:09.100 --> 07:10.810
Probably we will be able to see that.

07:11.260 --> 07:14.740
So Instagram, this is my all Instagram update details.

07:15.880 --> 07:18.760
And what about my Facebook details?

07:18.760 --> 07:19.750
There we go.

07:21.070 --> 07:21.580
Nice.

07:21.580 --> 07:24.730
And what about my LinkedIn details?

07:24.730 --> 07:26.950
And yes, I'm getting that the notice here.

07:26.950 --> 07:30.460
A couple of things that we need to now change or enhance as a feature.

07:30.460 --> 07:35.950
This date is okay, but it's not too much usable for the user, so I need to learn that how can I modify

07:35.950 --> 07:38.680
this date so it's much more usable for the person?

07:38.680 --> 07:40.210
That's my goal, number one.

07:40.210 --> 07:45.610
And also apart from this, I still need to worry about one of the things which is still missing in my

07:45.610 --> 07:53.530
application that how am I going to do this API v for or API V one, four or five or whatever this and

07:53.530 --> 07:55.210
it should return that immediately.

07:55.210 --> 07:56.560
So how I'm going to do that.

07:56.560 --> 07:59.440
So a couple of things in in my position right now.

08:00.310 --> 08:05.230
First thing, let's go ahead and take care about this date issue in the next video.
