1
00:00:00,510 --> 00:00:04,410
-: So far in this section we discussed four verbs.

2
00:00:04,410 --> 00:00:09,410
We talked about the GET, POST, PUT and DELETE,

3
00:00:09,600 --> 00:00:11,610
but actually these are not

4
00:00:11,610 --> 00:00:14,550
all the verbs that exist in the HTTP standard,

5
00:00:14,550 --> 00:00:16,470
and there are some more.

6
00:00:16,470 --> 00:00:17,303
In this lecture,

7
00:00:17,303 --> 00:00:20,790
I would like to review some rarely used verbs

8
00:00:20,790 --> 00:00:22,740
that you will probably never use

9
00:00:22,740 --> 00:00:26,670
but you should be aware of their existence.

10
00:00:26,670 --> 00:00:29,220
So, the first one is PATCH.

11
00:00:29,220 --> 00:00:31,770
PATCH is similar to PUT,

12
00:00:31,770 --> 00:00:34,500
but with partial update support,

13
00:00:34,500 --> 00:00:39,300
meaning if your server supports the PATCH verb,

14
00:00:39,300 --> 00:00:41,670
then it should be ready to accept,

15
00:00:41,670 --> 00:00:45,870
not only full resource with all its properties,

16
00:00:45,870 --> 00:00:48,060
but also partial resource.

17
00:00:48,060 --> 00:00:53,060
For example, if your resource is a car with five properties,

18
00:00:53,070 --> 00:00:55,920
let's say the color, the height, the max speed,

19
00:00:55,920 --> 00:00:58,260
the number of speeds in the transmission,

20
00:00:58,260 --> 00:00:59,580
and its acceleration,

21
00:00:59,580 --> 00:01:02,790
then a PATCH request can send only,

22
00:01:02,790 --> 00:01:04,560
for example, two of them,

23
00:01:04,560 --> 00:01:07,320
the color and the max speed,

24
00:01:07,320 --> 00:01:09,750
and the server should be able to update

25
00:01:09,750 --> 00:01:12,030
those specific properties even though

26
00:01:12,030 --> 00:01:15,630
the request contained only part of the entity.

27
00:01:15,630 --> 00:01:17,700
The next one is HEAD.

28
00:01:17,700 --> 00:01:20,400
HEAD is similar to GET,

29
00:01:20,400 --> 00:01:23,250
but without the body in the response.

30
00:01:23,250 --> 00:01:26,580
So, if you remember, when sending a GET request,

31
00:01:26,580 --> 00:01:29,820
we usually get a body in the response,

32
00:01:29,820 --> 00:01:32,910
and the body contains the data that we asked for.

33
00:01:32,910 --> 00:01:36,600
For example, the entity or the entities,

34
00:01:36,600 --> 00:01:38,790
if we asked for a list of entities,

35
00:01:38,790 --> 00:01:41,340
the HEAD verb, in contrast to this,

36
00:01:41,340 --> 00:01:42,900
will indicate to the server

37
00:01:42,900 --> 00:01:45,120
that it should not return a body,

38
00:01:45,120 --> 00:01:47,400
but only the status code.

39
00:01:47,400 --> 00:01:50,490
This verb can be used for a pre-check.

40
00:01:50,490 --> 00:01:54,660
For example, if I want to know if a specific entity exists,

41
00:01:54,660 --> 00:01:57,300
but I'm not interested in the entity itself,

42
00:01:57,300 --> 00:02:00,060
then I can send a HEAD request,

43
00:02:00,060 --> 00:02:03,120
and if I get back a 200 status code

44
00:02:03,120 --> 00:02:07,530
then the entity exists, even though I didn't get it back.

45
00:02:07,530 --> 00:02:09,720
The last verb is OPTIONS.

46
00:02:09,720 --> 00:02:12,480
OPTIONS request asks the server

47
00:02:12,480 --> 00:02:16,710
to specify the supported verbs of a specific URL.

48
00:02:16,710 --> 00:02:20,130
For example, if I send an OPTIONS request,

49
00:02:20,130 --> 00:02:23,670
and, in this case, it is sent using the curl command,

50
00:02:23,670 --> 00:02:26,823
then the server will respond with something like this.

51
00:02:28,590 --> 00:02:32,490
So, you see that the response contains the Allow header

52
00:02:32,490 --> 00:02:36,240
with OPTIONS, GET, HEAD, and POST,

53
00:02:36,240 --> 00:02:39,660
meaning those four verbs are supported

54
00:02:39,660 --> 00:02:43,830
for the URL specified, the example.org URL.

55
00:02:43,830 --> 00:02:47,460
So, this is a way for the server to notify the client

56
00:02:47,460 --> 00:02:50,283
which verbs they can use when accessing it.

