Part 3:Gentle Introduction to APIs for non-technical people… What is it? Why should we care ? And how to use them ?
NOTE: This article is part of the series. If you are new to this subject and want to learn the basics, you can start in Part 1. If you want to see only example of how APIs work, you can skip to Part 2.
Let’s recap our list of Goals:
- Learn what is an API, how it works, and definitions of the most commonly used terms in simple language (Part 1)
- Learn how APIs work in the grand scheme of things (Part 1)
- Demonstrate how API call works (Part 1)
- Demonstrate a simple example of real world use of APIs (Part 2)
- Discuss benefits & some use cases of API use in real life (Part 3)
In the previous sections, we covered Goals #1 through #4. We learned the basics of an API and saw an example of how to perform an API call. In this section we will continue with learning Goal #5. In particular, we will discuss about benefits of an API and what are some of the use cases.
Goal #5: Benefits & some examples of API use in real life
One of the reason of API’s popularity can be attributed to its universality. Meaning that you can make an API request in any programming language and you can you do it via URL bar in your browser, 3rd party app, or even from your computer’s terminal window.
Note: we don’t have to limit ourselves with just two applications. More than two applications can communicate with each other, which is the case with modern websites and apps.
In general, two or more services and platforms can communicate with each other as long as “they” talk in the manner consistent by both (Documentation and RESTful guidelines)
Product enhancement is another benefit and the reason of APIs’ popularity. Let’s revisit our Google Maps example from earlier. In our example, we wanted to embed Google Maps into our personal website. Now, think how many websites you are aware of that use Google Maps or Apple Maps. Just to name a few… Uber, DoorDash, USPS, Yelp, Instagram (or any other app that asks you to use your location).
API usage between different applications allows developers and businesses to focus on the things that they are interested in without always recreating the wheel. For example, Google Maps team focuses on providing most up to date map information. Their business model revolves around charging all the users for every API request. Now, let’s look into Yelp — a company that focuses on crowdsourcing information about businesses. Yelp uses Google Maps in their service to provide detailed info about particular restaurant and/or business. In turn, Yelp can provide an API of their own service with all the information about restaurants, with the food type and hours of operation. Next in line we have DoorDash — a company that focuses on food delivery. DoorDash might use restaurant hour info from Yelp and Google’s map functionality to display to user what options they have at any given hour.
Did you notice a pattern in the example above? In fact, I would like to point out 2 observations. First, each company focuses on their own strengths and doesn’t attempt to reinvent what was already done. Second, the order — Google Maps to Yelp to DoorDash — I presented in the example above, showcases how one service enhances the next one.
In general, APIs allow businesses to focus on their strengths, and APIs can be stacked together to enhance the service the business is providing.
No business wants to miss out on potential revenue and/or customers. As a result, that means that there can’t be any downtime in the service that the business is providing. In the world of software development it means setting up CI/CD pipeline to avoid any downtime. Imagine if Google or Apple Maps stopped working while you were driving on a highway.. Or payment service of the app crashed and you couldn’t purchase an item.. Not the end of the world, but business is losing revenue.
Additionally, each business strives to improve their product and stay competitive. Improvement means that the new features must be added to the product constantly. As a result, the underlying service the business provides will change, which can make existing API outdated.
Whether it is avoiding downtime or enhancing the service, the API developed can be reused or adapted. When service changes drastically, APIs can be rewritten and new versions can be rolled out, while the old version will be deployed in the production to avoid downtime.
Additionally, all RESTful APIs are stateless (in principle), which means that they don’t store any client related information on the server. In turn, that means that all the requests are independent from each other and contain all the necessary information for that specific request. Let’s suppose we have a GET command that retrieves customer information and requires only email address and login passcode. Now, let’s assume you decided to add one more input from user — a phone number for verification — to replace current GET command. Since there are no dependency between requests, you can create new (and similar) GET command and add new required field. In this instance, both APIs will be deployed and there is no need to rewrite everything from scratch or shut down the service.
Lastly, it is also possible to create micro-services using APIs out of one monolith system (one big application). In other words, break down one big application into smaller apps and allow them to communicate using APIs among each other. That way, if certain component fails, you will 1) know where the failure is happening and 2) only certain component will fail as opposed to entire system.
In general, APIs are highly adaptable and stateless, which makes their use in production environment desirable
In summary, the graphic below summaries 3 major benefits of the APIs discussed in this article. This is not by any means all inclusive list of all the benefits, but merely some of the obvious ones.
Some Notable Examples of APIs
We have discussed what are APIs and how they work somewhat extensively. Now, let’s discuss what are some examples of API use in business world. The three examples below I picked are not all inclusive list, nor are the most important. I picked those examples because they are universally applicable to any business: customers, payment (money) and marketing.
CRM Platforms: Let’s assume that your company would like to start sending mass marketing emails and notifications to your customer base. Let’s also assume you have Salesforce implemented with all the customer information with leads and opportunities. After browsing around you decide to use Mailchimp.com to start sending mass emails, because they have mature product with many features and well documented API. As both Salesforce and Mailchip have APIs and are cloud-based SaaS platforms, you can connect them to send to all leads mass marketing email and keep track of last correspondence.
Payment platforms: With Apple introducing Apple Pay and Venmo paving the way for cashless transactions, more and more operations are performed in contactless fashion. In fact, the latest development with Covid-19 might propel cashless transactions to reach broader audience at a faster pace than predicted. As a result of these payment services, many more have emerged that facilitate and remove the burden of dealing with setting up bank account for small and medium sized businesses. For example, Square — a payment company. Because of companies like Square, small sized businesses can easily set up online payment system on their websites and applications. Using Square’s APIs, app developers and small businesses can connect the payment system natively into their apps, and let Square handle most of the paperwork of transferring the money from one account to another.
Entertainment platforms: In the world where news can spread within seconds and viral content constantly circulates in popular social media, many companies regardless of their size, have to create social media content like ads and social media posts. Many companies such as Instagram, Facebook, LinkedIn and YouTube provide APIs that give information about current users. In other words, as long as you pay for an API request, you are free to access customer information including their location and posts. Although intrusive, it definitely can add value to business looking to expand its customer base.
Not immediately obvious, but social media can also be used to perform various analysis. For example, analyze customer sentiment. Let’s suppose Investment Bank company wants to analyze certain sentiment on particular company. Since software development is not primary focus for an IB company, they may want to outsource the task to developers to crawl the Twitter to see what is the latest sentiment regarding the stock of particular company. Now, no one will sit through and read those tweets one by one. Instead, Twitter’s own API can crawl through their system and output information with certain keywords. The information can be then sorted and filtered based on location, hashtags, keywords and so forth. Once, data is retrieved from Twitter, the next step will be making sense of it, but that is Data Scientist’s job.
The graphic below summarizes each example we discussed above.
In this 3 parts article we covered various topics about APIs. First, we defined the term API, and its most important components. Second, we showcased that APIs are platform and language independent. Also, we used Python to show how to pull data from an API provider, Zomato, and filter through it. Lastly, we discussed what are some of the benefits of the APIs and highlighted some uses cases.