1
00:00:01,560 --> 00:00:05,820
Instructor: So how does REST API request looks like?

2
00:00:05,820 --> 00:00:09,660
Well, the request usually has the following components.

3
00:00:09,660 --> 00:00:11,433
First, the method,

4
00:00:12,390 --> 00:00:15,270
which is actually an HTTP verb.

5
00:00:15,270 --> 00:00:19,140
It could be GET or POST, PUT, DELETE.

6
00:00:19,140 --> 00:00:23,520
Now, note that each verb has a very specific role

7
00:00:23,520 --> 00:00:25,650
that we'll discuss later.

8
00:00:25,650 --> 00:00:28,000
After the method, there is a URL.

9
00:00:28,000 --> 00:00:31,380
The URL is the location of the resource,

10
00:00:31,380 --> 00:00:33,753
and sometimes also, parameters.

11
00:00:34,830 --> 00:00:36,333
Then the headers,

12
00:00:37,350 --> 00:00:39,600
which contain metadata of the request,

13
00:00:39,600 --> 00:00:44,600
such as user agent authorization and some more metadata.

14
00:00:44,880 --> 00:00:47,790
And at last, the body,

15
00:00:47,790 --> 00:00:50,220
which is the contents of the request.

16
00:00:50,220 --> 00:00:53,760
Now, as we will see later, the body is an optional.

17
00:00:53,760 --> 00:00:56,853
Not all REST API requests contain body.

18
00:00:58,170 --> 00:01:02,460
So here is an example of a typical REST API request.

19
00:01:02,460 --> 00:01:04,410
And let's see the various components,

20
00:01:04,410 --> 00:01:07,020
how they map to these requests.

21
00:01:07,020 --> 00:01:09,780
So the method is right here.

22
00:01:09,780 --> 00:01:11,250
That's the word GET,

23
00:01:11,250 --> 00:01:15,060
which is a standard and quite common HTTP verb.

24
00:01:15,060 --> 00:01:16,800
Next is a URL.

25
00:01:16,800 --> 00:01:19,890
You can see it looks like a typical URL,

26
00:01:19,890 --> 00:01:22,350
with the forward slashes and all.

27
00:01:22,350 --> 00:01:24,330
And then, the headers.

28
00:01:24,330 --> 00:01:25,830
Now, as we said before,

29
00:01:25,830 --> 00:01:28,620
headers contain metadata about the request.

30
00:01:28,620 --> 00:01:31,050
So you can see here is a user agent,

31
00:01:31,050 --> 00:01:35,010
which represent the applications that made the request.

32
00:01:35,010 --> 00:01:37,650
You can see something about cache.

33
00:01:37,650 --> 00:01:41,220
You can see the host that the client accessed

34
00:01:41,220 --> 00:01:43,500
and some more metadata.

35
00:01:43,500 --> 00:01:47,283
So this is a typical REST API request.

