Do you know what an application program interface
is?
Or let's put it another way: Have you ever
heard of API?
Well, I guess you probably have, as it has
become a buzzword in IT in recent years.
Everyone is talking about building APIs for
their applications and even for external parties.
But do you know what exactly is REST API?
What is OpenAPI, Swagger, GraphQL, and how
they are related to each other?
In this video, I will explain all the terms
and tools that you may hear when you are talking
about API, as well as how they related to
each other.
Hi, this is Cloud Insights, a channel where
I will share my thoughts about the latest
technology trends, especially in cloud computing.
This video contains two parts.
In today's video I will focus more on explaining
the concept of each technology.
In the next video, I will focus on introducing
all the popular tools that people use when
developing and managing their API.
If you still don't know what an API is, you
can think of it as an ordering machine in
the restaurant.
You need to follow certain steps to send your
order to the kitchen, just like when a program
is calling the API of another program, they
need to follow the data formats and conventions
that API has to make a clear request of what
they want.
To summarise, an API specifies how two software
components should interact.
API is everywhere.
The one that we talk about most frequently
is the Web API.
There are various web APIs behind the applications
that we use every day.
For example, if you click the like button
of this video, Youtube will then call their
back-end API to update your preference.
In recent years, the trend of developing web
APIs has been moving away for SOAP-based web
services toward the REST style.
What is the REST?
How is that different from SOAP?
REST represents the REpresentational State
Transfer.
It sounds like a complicated phrase, but you
don't really understand each word.
Just remember, REST is an architectural style
for building the API.
There are six guiding constraints of REST,
for example, the API needs to be stateless
and cacheable.
You may check out the link below in the comments
for a detailed explanation of these principles.
If a web API satisfies all these constraints,
then it can be called a REST API or RESTful
API.
So how about SOAP?
Is this another style of API?
Well, that's not true.
SOAP refers to Simple Object Access Protocol,
which is actually a messaging protocol.
Protocol means a system of rules that allows
systems to communicate with each other.
As for the data format they use, SOAP only
uses XML, and REST often uses JSON, which
is a format that is shorter and easier to
read and write compared to XML.
As the REST API was getting popular, people
wanted to develop a standard format that is
understandable by both machines and humans
to document the API they developed.
Therefore, specifications like OpenAPI, RAML,
and API Blueprint were born.
OpenAPI Specification was originally known
as the Swagger Specification.
It was a project initiated by Linux Foundation
and supported by many tech companies like
Google and IBM.
RAML is another specification and it was introduced
by Mulesoft, an interesting company that we
will also mention in the next video.
API Blueprint was introduced by Apiary, which
is now part of Oracle.
Three to four years ago, both Mulesoft and
Apiary joined the OpenAPI Initiative, which
made OpenAPI Specification the most popular
standard for REST API.
Now that you know the meaning of these words,
you may be surprised at how the IT industry
loves to create new concepts and standards
from time to time that makes it hard to distinguish
from each other.
Well, at the end of this video, I will introduce
the last buzzword related to API.
It is GraphQL.
A lot of people think GraphQL is a new kind
of database.
But actually, it should be treated as another
type of API.
In fact, it provides another query language
for the API, as well as a server-side runtime
for executing queries.
GraphQL was created by Facebook to solve a
long-lasting drawback of REST API.
Imagine this is a design of a RESTful back-end
service for a social media application.
If our front-end wants to get the posts and
followers that a user has, it has to call
three endpoints to get the information required.
First, it needs to call the user endpoint
to get the initial user data.
Then it will call the post and followers API
separately.
This looks very inefficient, and you can even
imagine how things would get much more complex
when we keep having new requirements for the
API.
GraphQL, on the other hand, streamlines this
process by providing a new query format and
a runtime to execute the queries.
Therefore, your front-end can specify exactly
the data it needs and only calls the backend
once.
It also has a wide range of server libraries
that supports all the popular programming
languages.
So by now, I hope you understand these API
concepts and how they relate to each other.
In the next video, I will talk about all the
tools related to API, so remember to subscribe
to my channel so that you won't miss any updates.
This is the Cloud Insights, and I will see
you in the next one.
