WEBVTT

00:01.270 --> 00:02.110
Okay, everyone.

00:02.110 --> 00:05.200
So just a brief recap on the last section.

00:05.200 --> 00:12.430
We looked into the Nordstrom site and we tried to find an API or rather discover whether there's an

00:12.430 --> 00:17.920
API inside Nordstrom site that we can use to extract results.

00:17.920 --> 00:26.680
And we found something inside of this query where there's a response that looks exactly like the same

00:26.680 --> 00:29.680
data, the traces we're trying to get here.

00:29.950 --> 00:37.750
So now the next step we want to try now is to replicate calling this API, getting the result inside

00:37.750 --> 00:42.730
of Postman instead of inside of a browser inside the Nordstrom Web app.

00:42.970 --> 00:46.450
So we're going to try and do that and let's see how it goes.

00:47.280 --> 00:54.450
So as I search for query inside the network tab, when I search on the Nordstorm site like we did in

00:54.450 --> 01:03.300
the last section, we have the query down here with the Http get and for the query e-commerce e-commerce

01:03.330 --> 01:03.960
API.

01:05.430 --> 01:12.840
And so I'm going to take this URL here and copy that, and then I'm going to open up Postman.

01:13.880 --> 01:17.410
So if you don't have Postman already, just go ahead and download it.

01:17.420 --> 01:19.400
Google Postman download it.

01:19.970 --> 01:26.150
It's a free app to make calls in if you're not familiar with it already.

01:27.680 --> 01:33.110
So I'm starting up postman here and opening a new tab.

01:35.320 --> 01:43.450
And then I'll just paste in the URL here that we had inside of the Chrome tab where we search for query

01:43.930 --> 01:47.620
and find the hidden secret API.

01:48.280 --> 01:52.300
So I'm going to press send, make sure it's Http get.

01:53.510 --> 01:55.670
And now it gives us an error.

01:55.670 --> 02:01.790
It says for one unauthorized and it says a valid API key is required.

02:03.220 --> 02:12.610
So we need to find an API key and well, in the last section there was a part inside of the source where

02:12.610 --> 02:14.170
there was an API key.

02:15.130 --> 02:24.910
Now if we also try and look inside of the request headers in here inside of Google Chrome, we can see

02:24.910 --> 02:32.860
there's a header for authorization that says API key and then it has the API key in here.

02:32.860 --> 02:41.950
So what we can do is to replicate this header inside the request from Chrome where it says authorization

02:41.950 --> 02:44.290
and paste in the API key.

02:45.270 --> 02:47.010
So let's go ahead and do that.

02:47.010 --> 02:52.830
Go to the headers tab in Postman and type in authorization.

02:53.250 --> 02:55.170
Paste in the API key.

02:55.200 --> 02:58.160
Actually paste in the text as it says in here.

02:58.170 --> 03:06.000
I don't think it's useful that they write API key before they write the API key, but I mean every API

03:06.030 --> 03:07.080
is different.

03:07.080 --> 03:14.400
I mean there's just some developers who made this and they make weird quirks sometimes anyway.

03:15.170 --> 03:17.630
We try with this header now.

03:18.710 --> 03:20.030
Now it says another error.

03:20.060 --> 03:27.560
Now it says unable to parse the request version include a valid Nor API version header in the request.

03:27.560 --> 03:34.460
So it's even so nice to tell us that we need the Nor API version header inside of our requests.

03:34.460 --> 03:40.040
So let's go and look inside the Chrome request again and we can see.

03:41.060 --> 03:47.090
There is a header that is called nor a version and it has a value of one.

03:47.330 --> 03:52.160
So let's go ahead and go in the header tab again inside of Postman.

03:52.340 --> 03:57.920
Paste in the Nor version and put in one and let's see if it works now.

03:59.800 --> 04:09.580
So we get some nice data now and you can see the populations through sequin mini minidress, which is

04:09.790 --> 04:11.980
um, this one here.

04:11.980 --> 04:19.900
So it's not exactly the same order of items, but it's you're definitely getting some items using this

04:20.350 --> 04:20.980
core.

04:22.690 --> 04:25.300
Now let's see, what else can we change?

04:25.300 --> 04:32.200
So inside of the query parameters, this params tab, we can also set how many items we want.

04:32.200 --> 04:36.070
So if you want ten items we just set.

04:37.190 --> 04:37.730
Ten.

04:38.630 --> 04:40.850
And then we get more data.

04:40.850 --> 04:42.890
We get ten items instead.

04:44.090 --> 04:47.990
We can also change the search term here to be something like.

04:48.540 --> 04:57.210
Preen, then remember, it needs to be Uri encoded, I think it's called.

04:57.600 --> 05:07.200
So the space is encoded as a percent 20 sign where you can do that automatically inside of our JavaScript

05:07.200 --> 05:07.770
later.

05:07.800 --> 05:09.090
Don't worry about it.

05:10.050 --> 05:13.650
I'm just trying to show you that you can enter in keywords now.

05:14.370 --> 05:19.800
So now we're searching for green dresses instead and we get results for this.

05:20.520 --> 05:24.540
I'm not quite sure what include facets mean.

05:24.960 --> 05:28.080
Um, I haven't digged into that yet.

05:32.120 --> 05:39.080
But I am just going to leave it at false as it is by default inside of the Nordstrom site.

05:40.410 --> 05:47.730
Now what we can do is we have seen how to perform the API query inside of Postman.

05:47.760 --> 05:55.920
The next step now is to build our back end so we can query on our back end and then we can go to the

05:55.920 --> 06:00.600
Nordstrom API from the back end and return results from our own back end.

06:00.870 --> 06:10.820
Now the reason we make a back end is because most of the time these APIs have something called course,

06:11.040 --> 06:21.750
uh, set up, which means that not every site can just query from the Nordstrom site and return it on

06:21.750 --> 06:22.440
the app.

06:22.440 --> 06:25.350
You're making the front end app we're going to make.

06:25.560 --> 06:30.570
So we need to make our own back end usually imply our own course headers.

06:30.570 --> 06:36.570
If you don't know exactly what this means, we're going to get to it in the next section or the next

06:36.570 --> 06:39.060
one again and you'll see what I mean.

06:39.870 --> 06:43.530
But for now, we are getting the results.

06:43.530 --> 06:45.270
Fine instead of Postman.

06:45.390 --> 06:49.230
Next up is making the backend in NodeJS Express.
