Instructor: The last verb we'll discuss
is the delete verb.
The delete verb is used
to surprisingly enough, delete resources.
It should never be used to add
or update or retrieve resources.
And it almost always combined with parameters because
if we want to delete a resource, we should probably
tell the server which resource exactly we want to delete.
And this info will come in the shape of parameters.
Now, similar to the get verb
the delete verb should not include body.
So if you remember the four components of rest requests
then with the delete verb
there should be only three component, the method, the url
and of course the headers.
So again, note that the delete verb
is quite similar to the get.
So let's say a short demo of the delete verb.
So again, we found ourselves
in the Beceptor website, Mocking rules, create new rule.
And here we are going to select the delete and API order.
And let's say we want to delete order number 45
and the status that we will return is order.
Order 45 has been deleted.
So what we expect to get when we will call this API is
a status that confirms the order has actually been deleted.
Great, so let's save it
and go back to postman, modify here to delete.
Let's add here, the 45.
Now, as we mentioned earlier
the delete request should not contain any body.
So we'll select the none here like this
and let's send the request.
And as expected, we've got a status confirmation
that order 45 has been deleted.
So again, as you can see
the delete verb is used quite similarly to the get verb
and should not include any kind of body in the request.