As a teen, I remember the first time a video game prompted me to share an achievement with my friends through facebook. How could a game not related to facebook in any way communicate with the servers to make a post? Connecting applications together is vital for keeping up with the expanding technical world. This is done with APIs.
Jason Johl does a great job explaining what APIs are and how they are useful in the real world in his blog, “What Are APIs, and How Does an API Work?”. (https://blogs.mulesoft.com/learn-apis/api-led-connectivity/what-are-apis-how-do-apis-work/#:~:text=Share%20post&text=API%20stands%20for%20application%20programming,the%20response%20back%20to%20you) He starts of by explaining the importance of APIs and how they enable speed and agility in software. Then, gives a great example of how APIs can relate to a real life waitstaff at a restaurant. Followed up by examples of actual APIs used in booking a flight. Finally, listing different types of APIs, specifically the Web APIs, which I will be exploring more in detail later.
What is an API?
API stands for application programming interface, and is a messenger between software that handles delivery of the request and response. Much like how a waitstaff in a restaurant is trained to take a customer’s order to the kitchen and then return with the food. Kitchens take orders a certain way and it is the waitstaff’s job to translate the customers order into a format designed for the kitchen. Customers can’t interact directly with the kitchen, and must use the waitstaff to handle the requests.
How are API’s Used?
Travel sites are a great way to visualize APIs in work and how they are useful. The travel site collects information from a user on the client side and is able to take that information and search all different airlines databases to compile available flights. To do this, the client, in this case a web browser you are using to access the site, sends an individual request to each of the airlines servers through the use of an API. Then, the API in the airline servers takes that request, and returns all flights that match the fields such as dates and airports.
Common Web APIs
APIs can be designed and used for any software such as Java APIs allowing two objects to communicate with each other. In most cases, I will be working with Web API’s that communicate between a client and server. The most common Web APIs are Representational State Transfer (REST), Simple Object Access Protocol (SOAP), and Remote Procedure Call (RPC).
From the blog CS@Worcester – CS Learning by kbourassa18 and used with permission of the author. All other rights reserved by the author.