What is an API and how do they work?
APIs enable computer systems and other devices to communicate and exchange data in a standardized and transient way. APIs truly are a great invention and an essential part of what enabled the amazing development of apps and services in the last two decades. Before APIs, connecting two or more systems and making them communicate was quite cumbersome at times.
The API word is an acronym for Application Programming Interface.
History of APIs
Depending on how long you have been in the IT field, the term could mean different things when talking about APIs. In today's technology, it's Web APIs that everyone is talking about and using. This concept has revolutionized the Internet.
Salesforce, eBay, and Amazon were the first companies to offer access to their services via API in 2000. Let's take a quick and easy-to-understand example of how the Amazon API evolved. Say, for instance, you managed a website and wanted to display Amazon products on it. You would use the Amazon API to automatically add information about products (prices, descriptions, or stock) directly from Amazon. You would only need to set this up once by using an API. Amazon updates will communicate automatically to your website. Using an API, your website will always be current and up to date.
How an API works
One analogy that fits with how APIs work is the restaurant/waiter example. A restaurant has customers, waiters, and a kitchen. Customers scan the menu, choose, and place the order with the Waiter. The Waiter forwards the order to the kitchen and, when it's ready, the Waiter brings it to the customers.
In the above example, the API is the Waiter. He is the connection between the client and the provider. He takes orders (requests) and forwards them to the provider. After the provider (the chef) has received the request, it is worked on and then prepared a response; this is when the job of the API takes that response back to the customer.
If you explore our GraphQL article (https://novvum.io/blog/what-is-graphql), you can start to see how the API technology can be implemented. The GraphQL begins to "talk" with multiple waiters from different restaurants on your behalf, all at the same time. (Impressive). At any moment in time, you, the customer, could check and pick the best prices for various items in your order and have them delivered to your address from several different places.
Different types of APIs and Examples
The above waiter/restaurant example also does a good job at identifying two different types of APIs:
When interacting with an API, the client makes a request. Informational requests are fulfilled (answered) with information, i.e., ask if there is an egg in the pasta. These are typically fulfilled fast, under a minute. Other examples of real-world informational APIs are: getting a list of products from Amazon or getting the current weather conditions in a specific city.
Actionable requests are answered with deliverables and have consequences. In the restaurant, requesting a pasta dish will have the Waiter bring you the requested menu item, usually after about 20 minutes.
Uber, for example, is a company that provides developers with an API for its ride service. Developers of different systems/products can use the Uber API to automatically request a car at a specific address depending on the actions of users of said systems/products.
One great resource about APIs is the (https://mixedanalytics.com/blog/list-actually-free-open-no-auth-needed-apis/ ) comprehensive list of free APIs put together by Ana Kravitz. It's great because you get to "play" with these APIs right away, directly in your browser, without the need to create any accounts. This concept helps understand how a typical response from an API would work.
Here are some examples of APIs to help you better understand what is outputted when an API is called. The items chosen will open in a new tab in your browser and present you with information in text JSON format that could be easily read by another application:
US population by year: https://datausa.io/api/data?drilldowns=Nation&measures=Population
Currency Exchange Rates relative to USD: https://open.er-api.com/v6/latest/USD
Geo Information based on your IP address: https://freegeoip.app/json/
These are just some examples of APIs that are public to anyone and require no authentication.
Conclusion of the API
APIs are the backbone of modern Internet apps, services, and businesses. They are used everywhere and have become so popular that even small companies use them to expose functionality and appeal to a broader developer audience. An API indicates that your company understands clients' and developers' current needs and expectations. It's a sign that at least one technical person understands the technology behind the company.
As we finalize the discovery of APIs, I only have one more thought:
"Waiter! I want to order......"