Hello everyone and welcome back.
So let's start with a very important question.
This is in fact one of the most important questions of the entire course.
What is an EPA EPA stands for application programming interface and in general terms in EPA is a set
of clearly defined methods of communication between different software components a good EPA makes it
easier to develop software by providing all the building blocks which are then put together by developers
as a matter of fact an API declares an interface that allows us to interact with its logic without having
to know what happens as the saying goes under the hood and API eyes are everywhere really operating
systems programs programming languages and software libraries.
The Web of course computer hardware and so on.
Therefore there are different kinds of API in this course.
We're going to talk about web API as you can think about web API is as a set of protocols for communication
between either different web applications or different parts of the same application and that allow
external clients such as for example a smartphone app to connect and communicate with our web app.
Do most common kind of web API nowadays is addressed in the API is that will go into building this course
are going to be REST API.
Or as some developers like to call them RESTful API.
We will talk about the rest and its features in the next lesson.
Now it's very important to answer the following questions first.
Why would we want to develop an API in the first place.
What our API is really useful for.
Well let's take as example two very important companies like Instagram and Twitter.
They both have an official Web site.
You can access from the browser of course and they also provide applications for smartphones with different
operating systems such as Android in us in each one of these applications is access to the same synchronized
contents without a web API.
A basic architecture for a similar web service may look like the one shown in this diagram.
Each client app has its own embedded business logic.
Most likely written we have a specific programming language connecting them directly to the database
to get and manipulate data.
Maintaining is killing a Web service that uses such an architecture could easily become very challenging.
As for each new feature you might want to add to your web service.
You'd have to update each up accordingly Of course.
And this can be a very expensive event.
Error prone process which often leads to bugs feature fragmentation and overall project delays which
we never want to have.
API is allow us to build a much more powerful architecture instead.
Let's have a look.
Using an API first approach to development process gets much easier and faster.
The API provides a common interface that can be used by all the client applications to interact with
its own business logic so that each app as feature parity.
And if you need to implement a new feature or maybe an update you just make it in one place.
The apps itself will then simply become the user interface layer of a service we're providing to our
users.
With such an architecture it's important for the different parts of our application to communicate with
each other using a standard file format that should be both human readable and fast for computers to
process.
One of the most common file formats used by API is is Jason where Jason stands for JavaScript object
notation and the Jason object is a lease to a set of key value pairs surrounded by curly braces.
So this is an example of a scene pulling she's on object for a service slide could be Twitter for example.
As we've mentioned it's a set of key value pairs surrounded by curly braces and of course as we can
see this is both human readable and pretty fast for computers to process because let's say that our
front end client needs to show the creation date for.
That could be like a tweet object.
Okay.
It can just reference the creator dead key to know the exact date of creation of our tweet and as we
can see in this specific example that we are using strings each key is assigned to a string.
But if we need to of course we can use the structure the data types like for example lists.
So in this example that we see dead to make it easier for our client and overall to make our application
more performance.
OK we are using a new key aspects that we've assigned to an array at least of the ash stacks used on
the same tweet object.
And if we want to we can even get more advanced.
For example we see adjacent object nested weaving analogies an object so that for example if I needed
to know the location of the specific user that is written that specific tweet instance.
I would just have to reference user content of course location to noise without having to make another
request to our arrest API.
OK now that we've got an idea of what a way BPI is and what file format to use we rebid we might ask
ourselves how can we get access and interact with the API.
What sort of channel or access point should we use we can access our API is using this so-called end
points.
Typically you add real partners that we can use to specify what path equal information or service we
want to access.
Using the 5 format that are used by the API.
So for instance going to select tweets could give us an API.
Jason response containing at least with all the tweets of for example our tweets feed at a particular
moment in time in the system.
OK we might go to his left tweets as Lesh a primary key like 5 3 6 7 2 3 for example to grab the details
of a specific instance.
We could also go to his left tweets slash and the same primary key slash Ash text slash to get maybe
a list of all the ash tags of that same tweet object saving.
We could do for the details of the user that owns that tweet instance in the next lecture we're going
to continue our discussion about API is getting to the details of the technical implementation of a
specific kind of API that we are going to build throughout the course as we said rest api is this will
also give us the opportunity to talk about two very important related topics HDTV and status codes so
see you in the next lecture.