Back to Overview

API

backend integration communication

What is an API?

An API (Application Programming Interface) is a set of rules and protocols that allows different software applications to communicate with each other.

Simple Analogy

An API is like a waiter at a restaurant. You (the application) give the waiter (the API) your order (request), and the waiter goes to the kitchen (server/database), fetches your food (data), and brings it back to your table, without you needing to know how the kitchen works inside.

Example

When you use a weather app on your phone, the app uses a weather API to request current weather data from an external server. The API handles the communication between the app and the weather data service.

Code

Below is a super simple example of what an API could be. In this case an object that exposes methods that allows you do some things.


The fancy word for this is an “interface”. You don’t care how the methods are implemented or about the logic behind it, you just want to getData, writeData or doStuff.


An api is a ready made tool, application, collection of tools that allow you do some things without having to worry about how that thing is done.


class Api {
    constructor() {

    }
    getData(x){}
    writeData(x, y) {}
    doStuff(z) {}

}