1
00:00:00,210 --> 00:00:02,730
So what is the difference between put and patch?

2
00:00:03,300 --> 00:00:04,870
Well, here's a good analogy.

3
00:00:05,070 --> 00:00:10,410
Recently I went onto Amazon and I found a really nice looking bicycle.

4
00:00:10,770 --> 00:00:17,070
And because I really wanted to poison my lungs by exercising around London, I clicked on the Buy Now

5
00:00:17,070 --> 00:00:17,530
button.

6
00:00:17,730 --> 00:00:23,040
So there I was, super happy, super excited for my bicycle to arrive.

7
00:00:23,310 --> 00:00:29,880
And then on the day of arrival, I opened up that box and my bicycle was really messed up.

8
00:00:29,880 --> 00:00:31,640
The whole front wheel was broken.

9
00:00:31,950 --> 00:00:37,860
So I'm not really sure what happened at the Amazon warehouse, but I got in touch with them and I wanted

10
00:00:37,860 --> 00:00:40,200
to try and figure out how we can solve this problem.

11
00:00:40,410 --> 00:00:43,350
So there were two ways that they could fix this problem.

12
00:00:43,560 --> 00:00:47,760
Option one was they send me an entire new bike.

13
00:00:47,940 --> 00:00:55,860
So this is the equivalent of put. You're updating your database by sending an entire entry to replace

14
00:00:55,860 --> 00:00:56,760
the previous one.

15
00:00:57,570 --> 00:01:03,650
Now, the other option Amazon offered was for them to simply send me a new tire.

16
00:01:03,840 --> 00:01:05,760
That was the only thing that was broken,

17
00:01:06,030 --> 00:01:07,530
the rest of the bike was fine.

18
00:01:07,770 --> 00:01:13,890
And in order to save the world from carbon emissions, shipping a wheel is much better than shipping

19
00:01:13,890 --> 00:01:15,410
an entire bicycle.

20
00:01:15,930 --> 00:01:18,120
And this is the same as Patch.

21
00:01:18,360 --> 00:01:25,920
So when you're sending a patch request to the server, you're only sending the piece of data that needs

22
00:01:25,920 --> 00:01:30,950
to be updated. Instead of the entire entry that will be replaced,

23
00:01:31,170 --> 00:01:34,870
you're simply just updating the thing that needs to be updated.

24
00:01:34,890 --> 00:01:41,530
So when we see this in practice, I want you to think back to this bicycle analogy and maybe it'll help you try

25
00:01:41,530 --> 00:01:44,010
and understand the difference between these two words.

