DEV Community

Cover image for The Beginner's Guide to Understanding an API
Martins Oloyede
Martins Oloyede

Posted on

The Beginner's Guide to Understanding an API

Summary

If curiosity pushes you to learn about API's and you have the urge to learn about them, I highly recommend this article for you.

If you have written your first programming language like the

console.log("hello world!")
Enter fullscreen mode Exit fullscreen mode
print("Hello World!")
Enter fullscreen mode Exit fullscreen mode

then this article is suitable for you.

Introduction to API

The way we humans talk and communicate with each other by any form, maybe gestures, signs, is different to the way other creatures talk to themselves. But did you ever ask yourself how an app does that?

For instance, each time you listen or stream your favorite music via spotify or binge watch a movie on netflix, you are indirectly using an API.

In this article, I’ll present just how big an impact APIs have in our lives.

What is an API?

In the process of improving your applications, you will eventually come across a term like API.

API stands for Application Programme Interface

It is almost impossible to imagine modern web development without API's. I will try to explain it as simple as possible.

An API (Application Programming Interface) is a set of functions that allows applications to access data and interact with external software components, operating systems, or microservices. To simplify, an API delivers a user request to a system and sends the system’s response back to a user.

API is like an open language, the rules of which are shared by a certain service.

APIs are highly used because they can make things way easier and speed up the development process of other systems and applications.

You can teach your application the rules of this language, so it can communicate with the service and access all the functions and data that the service is ready to share.

Speaking formally, an API is an interface that allows your application to interact with an external service using a simple set of commands.

APIs are highly used because they can make things way easier and speed up the development process of other systems and applications. For example, if you are building your own software and wish to integrate face recognition or payment processing, using an API is the best way to do it. You just have to connect your software with another one. These are provided with the API’s documentation which is a manual for developers to help implement the desired functionalities.

The fun part is that you don't need to know or understand the internal logic of the service or deal with any source code by just sending a simple set of command and the service will run the necessary data. Sounds good, right? Cool, let’s take a look at just how APIs do that.

What is the engine behind this API?

Think of an API to be the “middleman” between the application you are using and the server. When you tell your mobile application or app to do something for you, then it will rush down to the API to assist in fetching your request. Afterward the server will send a response to be delivered by the "middleman" to your app.

For example, if you need to contact the news aggregator api and get ten of today’s most popular news from it, you refer to the “topnews” command (which the service described in advance in the public domain), and in response, the service will send you the latest collection of sensations.

Benefits of an API

APIs allow you to save time when developing and help not to invent a Car.

APIs recharge your applications with the latest technology. With APIs, you can teach your application the latest image recognition and natural language processing methods.

Types of API

Although APIs are classified under use cases and release policy. We'll be discussing the major types.

There are four main types of APIs:

  • Open APIs: In its simplest form, this type of API allows no form of restriction to using them because they are publicly available.

  • Internal APIs: Also known as Private APIs, only internal systems expose this type of API, which is, therefore, less known and often meant to be used inside the company. The company uses this type of API among the different internal teams to be able to improve its products and services.

  • Partner APIs: One needs specific rights or licenses in order to access this type of APIs because they are not available to the public. A partner API also adds value to the service and opens up a channel for up-selling.

  • Composite APIs: This type of API combines different data and service APIs. It is a sequence of tasks that run synchronously as a result of the execution and not at the request of a task. Its main uses are to speed up the process of execution and improve the performance of the listeners in the web interfaces.

Of particular interest are SOAP APIs and REST APIs, since these are very widespread.

EndPoints

Endpoints are basically the key elements in the interaction of your application with the API. Usually, it is a specific address (for example, https://newssite.com/topnews), by referring to which you get access to certain features/functions.

Like Muse would say, You don’t need to test an API on Postman Application before you are aware of the capabilities of the API.

Request Method

Request Methods characterize what action we are going to take by referring to the API. In total, there are four main types of actions:

  • GET: Requests data from a server. This is the most common type of request. Using it we can get the data we are interested in from those that the API is ready to share.

  • POST: What it simply does is that it adds new data to the server.

  • PUT: This request method changes existing information. For example, using this type of request, it would be possible to change the color or value of an existing product.

  • DELETE: Delete an existing Information.

Final Thoughts

I hope this article helped you better understand how APIs work and just how important they are in the world of information technology.

You can now head straight to learning how to use an API and receive informations in your different programming language/s.

Discussion (12)

Collapse
goodnessuc profile image
Ukeje Chukwuemeriwo Goodness

Nice

Collapse
devmayor15 profile image
Martins Oloyede Author

Thank you

Collapse
ernest2026 profile image
Ernesto

Interesting, would there be cont'n, or something like part 2 containing the REST and SOAP api, your writeup is concise and in it's simplest way, so I'll still wanna learn from you

Collapse
devmayor15 profile image
Martins Oloyede Author

Yes, I'll work on that.
Watch out!

Collapse
mmonnierey profile image
Mudahemuka Manzi Monnierey

Great content, keep it up

Collapse
devmayor15 profile image
Martins Oloyede Author

Thank you

Collapse
iykekelvins profile image
Kelvin Ochubili

Amazingly written!

Collapse
devmayor15 profile image
Martins Oloyede Author

Thank you

Collapse
trandainien profile image
Nie

really useful information. keep it up <3

Collapse
devmayor15 profile image
Martins Oloyede Author

Thank you

Collapse
1stmuse profile image
Akinnagbe Oluwasegun

good read

Collapse
devmayor15 profile image
Martins Oloyede Author

Thanks man