What is REST API?
(explained in 5 minutes or less)
API stands for Application Programming Interface. Basically, it’s something that allows different programs to interact with each other.
For the most part, when we talk about APIs on the web, we mean REST APIs. REST stands for “Representational state transfer”. REST is an underlying architecture, designed with the purpose to make the calls between computers simple.
It works the same way all websites do — the client sends a request to the server, and receives a response. The response is simply some data in JSON format, which makes it easy to use and interpret. For example if you want to get a list of posts from my blog, you can go to this url:
and you will receive a response that looks like this:
HTTP 200 OK
Allow: GET, HEAD, OPTIONS
"title": "What is Recursion?",
"body": "(post body is here...)",
.... (more posts here)
Basically it allows you to receive any data in both human- and machine-readable format.
This API can be used by anyone who wants to create, for example, an iOS or Android app for reading my blog, or for anyone who wants to write a script that would analyze my posts.
Many major sites, like Facebook or Twitter have an open API that allows developers to write applications and bots that can interact with them. You can not only read the data with it, but write it as well — you have probably seen many posts written by bots or by AutoModerators on reddit.
There are many other great and useful examples of APIs. Google Maps allows you to enter a city and receive it’s GPS coordinates, openweathermap.org allows you to receive the weather data about any point in the world, etc.