Client-side and Server-side APIs: How Computers Talk to Each Other
In the realm of the internet, virtual machines interact a lot with each other to help us users get the best service and experience. In the last blog post, we read that they talk to each other using secret codes called APIs. But how do these virtual machines understand each other — we will explore the same in this blog.
Let’s come back to your box of toys. Imagine you have a particular toy telephone that you can use to speak with a far-away friend. Remember the cup and thread telephone you used to make when you were a kid? This cutting-edge technology has two parts: the one you hold and the other your friend holds.
Client Side API
The client-side API is like the part of the telephone you hold. It helps you talk to your friend. You can ask for any information you seek from your side of the phone and hear the answer given by your friend.
The client-side API is also known as a frontend API (for obvious reasons). It is a collection of functions and protocols that allow the client (user) application to interact with external services, frameworks, or libraries. It’s like having different buttons and rules that enable the website to ask for things or do actions on another website. Common client-side APIs include:
1. Web APIs: These are tools provided by web browsers that let websites show pictures, load new information, or find your location.
2. Third-Party APIs: These are made by other companies that websites can use to do cool stuff. For example, a website can use an API from Twitter to show tweets or Google Maps to show maps.
3. JavaScript frameworks/libraries: They make it easier for developers to build websites. They have rules and protocols that help developers design a website/application or manage the website’s information.
Server Side API
The server-side API is the other side of the paper cup telephone that your friend holds. It helps them listen to your message, understand what you’re asking, and give you an answer. It’s like the paper cup on his side that lets your friend hear your question, understand it, and reply. So, for example, when you ask about the weather, your friend listens and tells you if it’s sunny, rainy, or snowy.
The server-side API is the backend of your telephonic information system. It helps the server handle requests from websites or apps, process data, and send back responses. It’s like a big machine that does important things behind the scenes. Here are some examples of server-side APIs:
1. REST APIs: These are a set of rules that the server follows when websites or apps want to do things like get information, add new data, update data, or delete data. The server uses code to understand what the website or app wants and sends back the correct information in formats like JSON or XML.
2. GraphQL APIs: These are a unique way of talking to the server. Websites or apps can ask for exactly what they need from the server, and the server responds with just that information. It’s like having a conversation where you can ask for specific things and get what you want with defined specifics.
3. SOAP APIs: These are used in big companies or systems where different parts need to talk to each other in a very structured way. It’s like having a different language that the server and other parts understand. They use messages in a format called XML to exchange information.
In the same way, when you’re using a computer or a phone, the client-side API helps your app or website talk to other services or websites. It lets you ask for information or send messages. For example, if you’re playing a game on your tablet and want more game coins, the client-side API helps you ask the game server for more coins.
And just like your friend on the other end of the toy telephone, the server-side API receives your message, understands what you’re asking, and sends back the information or the coins you requested. It’s like a specific computer that answers your questions or gives you what you need.
While APIs are the secret codes and languages used on the internet, the client-side and server-side APIs are the nodes that let you leverage this secret language and interact with multiple machines making the best use of the internet.
As a product manager, understanding the basics of technology goes a long way. You will have to interact and ideate with engineers and developers daily. Knowing the basics first-hand is always suitable for making better product decisions and creating an impeccable user experience.
This blog post is part of a series — Technology for New PMs.