What is an API?
An API is a set of routines, protocols, and tools for building software applications.
In plain language, APIs allow the software to communicate with each other by acting as a translator between them.
For example: If you want to connect your website with an email marketing service provider like MailChimp or AWeber.
How do APIs work?
An API (application programming interface) is simply a set of rules determining how one program can talk to another. When you request an API, you send data via HTTP (the same protocol that powers the web). If a website offers an API, it opens up its programming code and lets other applications talk to it. They’re called application programming interfaces: they allow people to build tools on top of existing platforms.
For example, suppose you have an email address book app with five contacts but want to add some more contacts from your Gmail account or Facebook friends list or SMS messages. You could write yourself some code every time you add someone new into your local database (which could get messy) or use an API instead. The best part about APIs is that most companies already offer them free.
The client requests the server. The server responds with data that the client receives. The client uses this data to display it on a screen or save it in a database.
The client can then send more requests to the server, usually for more of the same kind of thing it just got from its previous request (e.g., if you’re looking at some website’s inventory page on your phone and tap “buy,” you’ll likely be asked if you want that item shipped or picked up).
API examples: Facebook, Twitter, Google Maps, Instagram, Wikipedia, and YouTube have APIs that allow third-party developers to create applications using their data. Flickr also has an API you can use for your projects.