API in Programming

API in Programming

API is a popular term in Web Development and computer programming in general. It is frequently used by developers while building fullstack web, mobile and desktop apps. If you struggle with the term API, you will benefit from reading this article.

In this article, you will learn these:

  • My Initial thoughts about API

  • Meaning of API

  • Practical examples of API

  • Types of API

  • Methods of Using APIs

  • Resources to learn more

This article was originally my Twitter thread, click here to check it. Here are some things you should have been familiar with.

Prerequisite

  • Writing code

  • Basics of computer programming

Let's get started.

Initial Thoughts About API

My first impression about API before I got to use it was that it's another weird term to understand. It sounded weird at first because it's meaning cannot be understood from seeing the words.

To hear developers use it in a context I wasn't familiar with made matters worse. After much confusion, research and usage, I finally got a simple understanding.

I'll share for you here.

Meaning of API

API stands for Application Programming Interface.

For every development, there is an interface. View interfaces as the things you generally interact with. The faces of things, whether physical or not.

All applications, software or programs we use have interfaces we can interact with. For example, website has user interface (UI) for users to interact with the website. Websites or applications in general also interact with each other but they don’t necessarily require an interface you and I can see to communicate with each other.

Applications transfer data and functionalities via machine-readable interfaces called APIs. APIs are bridges between two software systems, making them to interact and share data or functionality easily.

For example, app A and app B is built. App B needs to interact with app A to make app B better. App B needs app A's API to communicate with it.

Practical examples of API

Checking Weather

When you use a weather app to check your current weather, you’re using an API. The weather app connects to a server that has information about your current location's weather and request for the weather data.

The server gets the request, interprets it, performs the necessary actions and sends it back to your weather app. The weather app then has the information about your current location weather and shows it to you.

The weather app used the software's API to make this possible.

Making Online Reservation

Airbnb is an American company that operates an online marketplace for short and long-term lodging house and experiences.

It started in 2008 when two designers had space to host three travelers looking for a place to stay. Now, millions of hosts use Airbnb to rent their space and travelers use Airbnb to book accommodations.

Airbnb help people find vacation rentals, cabins, beach houses, homes and book flight tickets. Airbnb doesn't own these airplanes, homes and properties they rent out, they only help people to find them online and use it.

Let's focus on Airbnb flight bookings.

The real owners of the airlines have applications where they show data about available tickets. They also provide APIs for other software (Airbnb) to interact with their data.

Airbnb uses these airline's API to check for available flight tickets. If there are available tickets, they also help make reservations.

The interactions between Airbnb and airline's applications are possible because of API. It helps connects the airline's information to users who want to book a flight.

Everyday you use the internet, probably to check the weather or get data of any kind, you have indirectly used an API.

Let's look at the types of APIs.

Types of APIs

  1. Private API

    Private APIs is used within an organization, it is not shown to developers outside the organization. Private APIs opens parts of an organization's backend data and application functionality for use by developers in the organization.

  2. Public API

    Public APIs are external APIs available for any third-party developers to use in their applications. Public API can be free or paid for. Documentations on how to use these API are also provided for developers. If you want to see free API you can use in your web projects, check Rapid website.

  3. Partner API

    Partner APIs are built for use between two business partners. Not for the public. They also need entitlement for developers to use.

  4. Composite API

    Composite APIs are designed to batch API requests into a single API call. Developers make one API request instead of multiple request to a server and receive one response.

Methods of Using APIs

  1. Database API

    Database APIs enable communication between an application and a database management system. This is how you connect MongoDB with your web development project.

  2. Remote API

    Remote APIs makes interaction for applications running on different machines possible over a network like the internet.

  3. Web APIs

    Web API provide data and functionality transfer on the web by sending requests from web apps and getting responses come from servers. Communications are done through standard web protocols like HTTP. HTTP uses RESTful services and methods like GET, POST, PUT, DELETE to perform operations.

  4. Operating systems APIs

    This group of APIs defines how applications use the resources and services of an operating systems.

Resources to Learn More

Conclusion

Learning to build applications - web, mobile or desktop will always involve communicating with other applications. You will definitely use an API as you build fullstack applications.

That will be all. Hope you found value here as you learn to build more projects effectively.

If you enjoyed this article and want to see more content related to JavaScript and Web development, then follow me here, Twitter (X) or connect on LinkedIn. I'd be happy to count you as one of my ever-growing group of awesome friends on the internet.

Join my WhatsApp community of 200+ developers learning and building cool projects.

If you also want to support me, you can buy a cup of coffee for me here.

Thanks && Bye. 👋