-: So far in this section we discussed four verbs.
We talked about the GET, POST, PUT and DELETE,
but actually these are not
all the verbs that exist in the HTTP standard,
and there are some more.
In this lecture,
I would like to review some rarely used verbs
that you will probably never use
but you should be aware of their existence.
So, the first one is PATCH.
PATCH is similar to PUT,
but with partial update support,
meaning if your server supports the PATCH verb,
then it should be ready to accept,
not only full resource with all its properties,
but also partial resource.
For example, if your resource is a car with five properties,
let's say the color, the height, the max speed,
the number of speeds in the transmission,
and its acceleration,
then a PATCH request can send only,
for example, two of them,
the color and the max speed,
and the server should be able to update
those specific properties even though
the request contained only part of the entity.
The next one is HEAD.
HEAD is similar to GET,
but without the body in the response.
So, if you remember, when sending a GET request,
we usually get a body in the response,
and the body contains the data that we asked for.
For example, the entity or the entities,
if we asked for a list of entities,
the HEAD verb, in contrast to this,
will indicate to the server
that it should not return a body,
but only the status code.
This verb can be used for a pre-check.
For example, if I want to know if a specific entity exists,
but I'm not interested in the entity itself,
then I can send a HEAD request,
and if I get back a 200 status code
then the entity exists, even though I didn't get it back.
The last verb is OPTIONS.
OPTIONS request asks the server
to specify the supported verbs of a specific URL.
For example, if I send an OPTIONS request,
and, in this case, it is sent using the curl command,
then the server will respond with something like this.
So, you see that the response contains the Allow header
with OPTIONS, GET, HEAD, and POST,
meaning those four verbs are supported
for the URL specified, the example.org URL.
So, this is a way for the server to notify the client
which verbs they can use when accessing it.