1
00:00:00,900 --> 00:00:01,590
Welcome back.

2
00:00:01,980 --> 00:00:09,150
Now what we need to do is that we need to learn how to create a new movie so we know how to get and

3
00:00:09,510 --> 00:00:12,930
get a movie by it and also how to delete a movie.

4
00:00:13,230 --> 00:00:15,120
Now it's time to create a movie.

5
00:00:16,260 --> 00:00:23,340
Hear a case of these movies, obviously here in the script, but we need an endpoint that would allow

6
00:00:23,340 --> 00:00:29,190
users and your clients to create new movies and insert new movies to this.

7
00:00:29,550 --> 00:00:29,940
All right.

8
00:00:30,510 --> 00:00:38,130
So in order to get the new movie, we need to use a past request because creating a movie is whenever

9
00:00:38,130 --> 00:00:46,950
you are creating a movie or not a movie, whatever you are creating something in, in any API, you

10
00:00:46,950 --> 00:00:48,300
need to use a pass request.

11
00:00:48,870 --> 00:00:50,550
So here I'm going to say act up.

12
00:00:50,970 --> 00:00:54,930
And then instead of saying get or delete tweet was a bust.

13
00:00:55,320 --> 00:01:01,350
So the post's request is always used whenever you are creating something, whenever you are inserting

14
00:01:01,350 --> 00:01:08,820
something new to your API, to your database or your array, or whatever data type you are using.

15
00:01:09,780 --> 00:01:17,180
Now here we need to say pause and then movie because we are inserting a single movie.

16
00:01:17,190 --> 00:01:26,250
So we need to say for a slasher movie and the past, you need to know that the post request never takes

17
00:01:26,880 --> 00:01:27,510
a.

18
00:01:28,790 --> 00:01:37,670
A parameter in its you r l, so they pass request always consists of a u r l without a parameter and

19
00:01:37,670 --> 00:01:44,750
then we can't say death, and then let's give the function I'm going to say yet movie score, movie

20
00:01:45,380 --> 00:01:50,120
and then now we need to pass with this function.

21
00:01:50,120 --> 00:01:54,580
We need to pass the movie that we that we will receive from the user.

22
00:01:54,590 --> 00:02:01,760
So I'm going to say here at the top of that movie is going to be a dictionary, a dictionary.

23
00:02:01,790 --> 00:02:02,720
We need a dictionary.

24
00:02:03,320 --> 00:02:08,660
Therefore, I'm going to say here, colon and then the backed, which is dictionary.

25
00:02:10,130 --> 00:02:11,540
Now it's this function.

26
00:02:12,140 --> 00:02:17,240
We need to insert that movie into the movie, so we need to say movies.

27
00:02:18,690 --> 00:02:21,660
That's a band.

28
00:02:21,930 --> 00:02:24,180
Then we need to upend the movie.

29
00:02:25,680 --> 00:02:31,380
So the append function would insert that piece of data at the end of the era.

30
00:02:31,860 --> 00:02:38,820
So this movie will be inserted at the end of their day and then we need to return, return and let's

31
00:02:38,820 --> 00:02:40,080
return with all movies.

32
00:02:40,140 --> 00:02:47,010
I'm going to say return and then movies return with all of the movies that we have.

33
00:02:47,790 --> 00:02:56,910
Or you can return with the movie that has just been created by saying movies and then minus one if you

34
00:02:56,910 --> 00:02:58,440
pass minus one to the array.

35
00:02:58,830 --> 00:03:04,620
This would return the latest element of the last element of their return.

36
00:03:05,340 --> 00:03:10,680
Let's now save on this suddenly, you click on file table and let's test.

37
00:03:11,280 --> 00:03:12,540
Now let me refresh.

38
00:03:12,870 --> 00:03:13,430
Let's test.

39
00:03:14,040 --> 00:03:18,810
So if you refresh, you will find that we have now a new you are ill.

40
00:03:19,930 --> 00:03:22,450
Which is movie and the type is bust.

41
00:03:23,200 --> 00:03:24,820
And here it says great movie.

42
00:03:25,300 --> 00:03:27,370
So let's use it when you click on Try.

43
00:03:27,460 --> 00:03:30,160
Try it out and let's insert something.

44
00:03:30,160 --> 00:03:34,900
So here the body request the request body takes.

45
00:03:35,080 --> 00:03:45,400
As you can see, it takes a dictionary, so the dictionary needs to elements needs to to key key value

46
00:03:45,400 --> 00:03:45,790
pairs.

47
00:03:46,630 --> 00:03:51,460
The first key is laying out the year this first.

48
00:03:53,690 --> 00:04:02,450
So the first key, the first key value pair is the title because we are inserting the title first and

49
00:04:02,450 --> 00:04:03,050
then the year.

50
00:04:03,530 --> 00:04:06,070
So we need the title and then we need the year.

51
00:04:07,580 --> 00:04:14,330
Let me say, for example, here Batman Begins and the year.

52
00:04:14,690 --> 00:04:22,940
The year obviously is an integer, so I'm going to say two thousand five and we are good to go now since

53
00:04:22,940 --> 00:04:24,960
this is a dictionary.

54
00:04:24,980 --> 00:04:26,960
Make sure that the syntax is correct.

55
00:04:27,950 --> 00:04:33,020
You just need to click on, excuse me, click on execute and execute your.

56
00:04:34,830 --> 00:04:42,060
And as you can see here, it says two hundred, which is which is the success stories.

57
00:04:42,600 --> 00:04:48,810
And here it says responsibility, which is this responsibility by which is the movie that we have inserted.

58
00:04:49,290 --> 00:04:55,170
If you want to make sure that the the um, the movie has been inserted, of course, of course it has

59
00:04:55,170 --> 00:04:57,630
been inserted because it's has a successful response.

60
00:04:58,590 --> 00:05:05,100
But if you want to make, if you just want to double check that it has incentive, you can get all of

61
00:05:05,100 --> 00:05:10,080
the movies you can here up in this you want and point, which is all of the movies.

62
00:05:10,770 --> 00:05:16,350
And then you can hear click on dry, try out excuse and you should get.

63
00:05:17,460 --> 00:05:24,240
At the end, you should get your Batman Begins, I got I got Batman Begins twice because I click on

64
00:05:24,240 --> 00:05:30,330
the Execute button twice, so it's inserted the movie twice, but it works successfully.

65
00:05:30,330 --> 00:05:39,540
And now we know how to insert a movie and new movie into the array, and this is how we can get the

66
00:05:39,540 --> 00:05:40,820
movie into the right.
