Data is typically stored in a database. The API is used to send information to or receive from information from another system in a pre-defined format.
The requested information usually originates in a database, but the databases do not communicate directly. The API services the information requests and provides the responses to those requests:
- The native API layer request information from the foreign API layer (the request).
- The foreign API layer reads from the foreign database and replies to the native API layer (the response).
- The native API layer writes to the native database through the data access layer (process of the response).
The API acts like a translator between two people that speak different languages.
A website or application makes an API call to request a set of data or information from a foreign system.
The way an API functions is often compared to how a waiter in a restaurant acts as the intermediary between you (the customer) and kitchen. The customer doesn’t need to know how the food will be made but they know they will get what they requested. It isn’t the making of the food, but the exchange of messages that is key.