What is an API?
Options
- A programming language that is used to build servers
- A defined way for one program to request data or actions from another (Correct option)
- A type of database that stores the request logs of an app
- A visual design tool that is used to draw interfaces
Answer
A defined way for one program to request data or actions from another, e.g. over HTTP
Why
API means Application Programming Interface: the 'menu' a system offers to other programs. It lists what you can ask for and in what format, and hides how it works inside.
A web API is reached over HTTP. Example: a weather app sends GET https://api.weather.com/today?city=Lima and receives JSON with the forecast.
Remember
API = a contract for programs to talk to each other.