Go to lewagon.com

What are APIs and why are they so useful?

Have you ever made a payment with PayPal, asked Alexa for the weather or logged into an application using Facebook? All of these tasks use API integration. Although you may not realise it, APIs are everywhere and are extremely useful
Summary

What are APIs?


Read on to find out more about what an API is and their uses


Have you ever made a payment with PayPal, asked Alexa for the weather or logged into an application using Facebook? All of these tasks use API integration. Although you may not realise it, APIs are everywhere and are extremely useful.  They allow us to share data, inspire new ideas and have helped speed up the development of new products.

Although it sounds more like a beer than a tech product, API stands for Application Programming Interface. A better way to understand what they do is by reversing the acronym; an API is an Interface, which is used by Programmers, allowing them to interact with an Application. In other words, APIs expose a service, which developers then consume. The reason why APIs are so popular is because they abstract complexity and make the life of a developer a lot easier. Every API comes with a set of instructions, which explain to developers how to use them. Using this documentation and by writing a few lines of code, developers can then call the API, which grants them access to the service. APIs save developers from having to recode the feature from scratch, which ultimately saves a lot of time and money.
Share data using APIs

APIs are present in everyday life


Let’s look at some examples of commonly used APIs to put this knowledge into everyday life. Geocoding APIs are some of the most well known and well used today. Have you ever browsed for flats using the map on AirBnB or checked the location of a shop on a map displayed on a site? The chances are they were using Google Maps API or another geo API such as MapBox. Google Maps API is so widely used as it was created way back in 2005 and almost every web page that displays a map uses it. What developers love about the Google Maps API is that it allows you to customise the map and markers to fit with your branding. Thanks to Google’s hard work, not only do you have access to a ready-built map and all of their complex features, but you can design and style it to suit your site and make it look like you did in fact build it from scratch!

Another example of a well known API is Twilio, which sends programmable SMS to your mobile. For example, have you ever received a text message from Uber saying that your driver is downstairs or a text from a delivery company informing you when you can expect your parcel? Twilio’s API does exactly that - sends programmed text messages to your mobile phone, no matter the number or network. What’s even more special about Twilio is, unlike at Google where Google Maps API is a side product, Twilio’s text message API is their only product and they’re doing extremely well. Twilio is a perfect example of abstracting complexity from a program that would be otherwise extremely complicated to build. Imagine trying to build a program that could send a text message to any global number under any global network provider. Sounds tricky, right? Well, it is! Twilio has done the hard work for you, making what would have been an extremely comprehensive program into an accessible tool that can be used by developers across the world.
Code your API

Why are we using APIs?


The technical aspect of APIs


That all sounds great, but how do we actually use the API’s service? Let’s get a bit more technical! The API’s service, i.e. the map functionality from Google Maps, is exposed via URLs which are triggered by HTTP requests made up of a verb and a URL. If you have ever tried to get data from another source on the internet, you have probably heard of REST. REST is basically a set of conventions or rules, which are followed when APIs are created. When dealing with RESTful APIs, only a select number of verbs are used in the HTTP request, depending on the operation we are carrying out on the API’s database. When an API is RESTful, it means that there are four main operations that we can perform on its database - we can Read, Create, Update and Delete. For example, when you log into a website or app and select the option 'Log in with Facebook', some code is triggered, which "calls" the Facebook API via an HTTP request (developers say ‘calling an API’). This request will then trigger a response from the Facebook API which will contain the information of the user (using cookies facebook can tell which user is connected on the laptop you're using). The response sends back your information (email, name, profile photo), which is then saved to the database of the site or app you're trying to log in to. Here is a sketch to bring the logic to life:
Patern of an API

APIs are great for business. It is unbelievable to think that many services, such as Twilio, have been so successful with just an API as their business model. Not only have APIs changed the business market, but they have also improved the way developers build and design products and prototypes. APIs abstract complexity and are easy to integrate on top of products. This allows us to build prototypes quickly and effectively with fewer constraints and therefore more creativity. They have completely transformed the web’s landscape and continue to inspire ideas for many entrepreneurs and developers around the world. Now it’s time for you to explore the powerful world of APIs and see what you can achieve! 
Our users have also consulted:
Coding Means That I Can Communicate

Olivia joined the first ever Le Wagon London batch! We look back at her awesome

Pour développe mes compétences
Formation développeur web
Formation data scientist
Formation data analyst
Les internautes ont également consulté :
Think like a developer and build real products.

“Instead of telling you what the bugs are, Le Wagon teaches you how to debug

Suscribe to our newsletter

Receive a monthly newsletter with personalized tech tips.