1
00:00:00,000 --> 00:00:02,190
Instructor: The last verb we'll discuss

2
00:00:02,190 --> 00:00:04,418
is the delete verb.

3
00:00:04,418 --> 00:00:06,240
The delete verb is used

4
00:00:06,240 --> 00:00:09,123
to surprisingly enough, delete resources.

5
00:00:09,123 --> 00:00:11,511
It should never be used to add

6
00:00:11,511 --> 00:00:14,662
or update or retrieve resources.

7
00:00:14,662 --> 00:00:18,090
And it almost always combined with parameters because

8
00:00:18,090 --> 00:00:21,180
if we want to delete a resource, we should probably

9
00:00:21,180 --> 00:00:24,000
tell the server which resource exactly we want to delete.

10
00:00:24,000 --> 00:00:27,246
And this info will come in the shape of parameters.

11
00:00:27,246 --> 00:00:29,153
Now, similar to the get verb

12
00:00:29,153 --> 00:00:31,950
the delete verb should not include body.

13
00:00:31,950 --> 00:00:36,257
So if you remember the four components of rest requests

14
00:00:36,257 --> 00:00:37,741
then with the delete verb

15
00:00:37,741 --> 00:00:41,875
there should be only three component, the method, the url

16
00:00:41,875 --> 00:00:43,828
and of course the headers.

17
00:00:43,828 --> 00:00:46,440
So again, note that the delete verb

18
00:00:46,440 --> 00:00:49,560
is quite similar to the get.

19
00:00:49,560 --> 00:00:52,500
So let's say a short demo of the delete verb.

20
00:00:52,500 --> 00:00:53,817
So again, we found ourselves

21
00:00:53,817 --> 00:00:58,817
in the Beceptor website, Mocking rules, create new rule.

22
00:00:58,830 --> 00:01:03,830
And here we are going to select the delete and API order.

23
00:01:07,800 --> 00:01:11,710
And let's say we want to delete order number 45

24
00:01:13,410 --> 00:01:17,073
and the status that we will return is order.

25
00:01:17,910 --> 00:01:22,443
Order 45 has been deleted.

26
00:01:25,500 --> 00:01:29,831
So what we expect to get when we will call this API is

27
00:01:29,831 --> 00:01:34,590
a status that confirms the order has actually been deleted.

28
00:01:34,590 --> 00:01:36,960
Great, so let's save it

29
00:01:36,960 --> 00:01:41,960
and go back to postman, modify here to delete.

30
00:01:44,910 --> 00:01:48,690
Let's add here, the 45.

31
00:01:48,690 --> 00:01:50,397
Now, as we mentioned earlier

32
00:01:50,397 --> 00:01:54,330
the delete request should not contain any body.

33
00:01:54,330 --> 00:01:59,106
So we'll select the none here like this

34
00:01:59,106 --> 00:02:02,103
and let's send the request.

35
00:02:03,990 --> 00:02:06,482
And as expected, we've got a status confirmation

36
00:02:06,482 --> 00:02:09,423
that order 45 has been deleted.

37
00:02:10,380 --> 00:02:11,688
So again, as you can see

38
00:02:11,688 --> 00:02:15,810
the delete verb is used quite similarly to the get verb

39
00:02:15,810 --> 00:02:19,593
and should not include any kind of body in the request.

