WEBVTT

1
00:00:00.160 --> 00:00:01.660
Hi and welcome back.

2
00:00:01.680 --> 00:00:04.810
In our previous lecture,
we talked about what a server is,

3
00:00:04.840 --> 00:00:08.010
how it serves as a central hub
for storing and sharing data.

4
00:00:08.040 --> 00:00:10.090
Now we will dive into another essential

5
00:00:10.120 --> 00:00:13.340
aspect of software development,
which is APIs.

6
00:00:13.370 --> 00:00:16.500
API stands for application
Programming Interface.

7
00:00:16.530 --> 00:00:19.260
An API is a set of protocols, routines,

8
00:00:19.290 --> 00:00:21.660
and tools for building
software applications.

9
00:00:21.690 --> 00:00:26.140
And simply put, it defines how different
software component should interact

10
00:00:26.170 --> 00:00:27.132
with each other.

11
00:00:27.332 --> 00:00:30.380
In the context
of mobile app and server communication.

12
00:00:30.400 --> 00:00:32.383
APIs are used to allow the mobile app

13
00:00:32.583 --> 00:00:34.580
to communicate with the server and access

14
00:00:34.610 --> 00:00:36.062
data and functionality

15
00:00:36.262 --> 00:00:37.580
provided by the server.

16
00:00:37.600 --> 00:00:41.260
When a mobile app wants to retrieve data
or perform an action on the server,

17
00:00:41.290 --> 00:00:45.740
it sends a request through the API and the
server responds with the requested data.

18
00:00:45.770 --> 00:00:49.980
In addition to defining the interactions
between the mobile app and server,

19
00:00:50.010 --> 00:00:53.740
APIs also require different
types of requests to be made.

20
00:00:53.770 --> 00:00:56.744
These requests are typically categorized

21
00:00:56.944 --> 00:00:58.900
as get, post, put and delete.

22
00:00:58.930 --> 00:01:01.940
A Get request is used to retrieve
data from the server.

23
00:01:01.970 --> 00:01:03.820
For example, if we want to retrieve

24
00:01:03.850 --> 00:01:07.850
information about specific book,
we would make a get request to the server

25
00:01:07.880 --> 00:01:11.180
through the API asking
for the book information.

26
00:01:11.210 --> 00:01:14.660
A post request is used
to send data to the server.

27
00:01:14.690 --> 00:01:17.700
For example, if we wanted to add a new
book to the database,

28
00:01:17.720 --> 00:01:21.100
we would make a post request
to the server, send the information about

29
00:01:21.130 --> 00:01:25.570
the new book, and create this
new book using the server.

30
00:01:25.600 --> 00:01:29.060
A put request is used to update
existing data on the server.

31
00:01:29.080 --> 00:01:30.460
For example, if we wanted to change

32
00:01:30.490 --> 00:01:33.620
the price of a book,
we would make a put request to the server

33
00:01:33.650 --> 00:01:36.740
through the API sending
the updated book data.

34
00:01:36.770 --> 00:01:38.964
And a delete request is something

35
00:01:39.164 --> 00:01:41.490
that you probably could guess already.

36
00:01:41.520 --> 00:01:43.660
It would remove data from the server.

37
00:01:43.680 --> 00:01:45.520
And for example, if we wanted to delete

38
00:01:45.550 --> 00:01:46.971
a book from the database,

39
00:01:47.171 --> 00:01:48.620
we would make delete requests

40
00:01:48.650 --> 00:01:52.570
to the server through the API,
specifying which book to delete.

41
00:01:52.600 --> 00:01:56.240
Now that we understand what an API is,
how it works, and the different types

42
00:01:56.270 --> 00:02:00.570
of requests that APIs use, we can move
on to the practical side of things.

43
00:02:00.600 --> 00:02:05.340
In this section, we will be learning how
to create APIs using NodeJS and Express.

44
00:02:05.360 --> 00:02:07.240
We'll learn how to handle different types

45
00:02:07.270 --> 00:02:12.580
of requests and use them to retrieve, add,
update and delete data from the server.

46
00:02:12.610 --> 00:02:16.170
By the end of this section,
you'll have the skills necessary to build

47
00:02:16.200 --> 00:02:21.060
robust, scalable APIs for your
mobile app and server communication.

48
00:02:21.080 --> 00:02:23.520
Thanks so much for watching,
and I'll see you in the next video.

