# API introduction

API is a shorthand for Application Programming Interface, i.e. an ‘interface’ which allows communication between two applications:

  1. You address the API (= request)
  2. The API executes internal logic, unknown to the user
  3. The API sends back information (= response)

High level architecture of the above process:

High level architecture

APIs enable communication between applications

  1. One application exposes an API
    • Exposing an API = giving functionality to the ‘outside world’
  2. Other applications can consume this API
    • Consuming an API = making use of functionality given by an API (= calling an API and using the information given back by the API)

Biggest advantage: ABSTRACTION

  • Your application should not know what happens ‘under the hood’ at the API, only the data you get back matters.
  • What happens ‘behind’ the API is not known to the user or the consuming application → business logic of the exposing application is better protected.

☕ Abstract example of an API: the coffee machine ☕

The user wants a latte with extra milk:

  1. 🔌 Start the coffee machine
  2. ☕ Choose ‘latte’
  3. 🥛 Choose ‘extra milk’
  4. ✅ Press ‘start’
  5. ⏱ Wait until the latte is made

The user does not know what happens inside the coffee machine…

  • They chose a latte with extra milk using the touch screen on the coffee machine, but did not specify which internal component of the coffee machine should perform which task.
  • The touch screen serves as an API for the coffee machine: the user tells the touch screen what they want, and the touch screen sends this information to the internal components of the coffee machine.
Last Updated: 1/11/2024, 1:05:49 PM