The Basics of APIs
What APIs are and why they are important.
Introduction
We use the internet in every aspect of our lives. We search for things, use social media, and send text messages via the internet. But how exactly do these things work?
The way we text is by typing a message, clicking send, and the person on the other end receives the message. How does this work? Well, there’s actually a middle-man called an API.
What is an API?
API stands for Application Programming Interface. A client and a server communicate via API’s with requests and responses. So what do APIs do specifically? APIs take in input data and send it to the opposite side. If you had a social media app, and you wanted to view a person’s photo, you (the client) would communicate with an API, and the API would request the photo from the person (the server), and show it to you.
Types of APIs
In addition to this, there are also several other types of APIs with different functions:
Soap APIs
Simple Object Access Protocols exchange simple data types such as text messages. It can only exchange simple data and nothing complex. It is not used as much today. A practical use case of this is a texting application.
RPC APIs
Remote Procedure Calls allow for the client to call a function for the client to complete. The server sends the output back to the client.
WebSocket APIs
Uses JSON objects to pass data. It is special because it has two-way communication between client and server. It is known for its efficiency.
REST APIs
REST APIs, short for Representational State Transfer, are the most popular APIs. Similar to RPC APIs. They allow the client to call a function for the client to complete. However, REST APIs are more flexible and efficient.
API Endpoints
Just like if you had a port for cargo ships, APIs have ports called Endpoints. These endpoints are the final points in the communication system of APIs. They allow all the data to be transferred through them. Therefore, it is important for there to be high security in the endpoints so that your data does not get compromised.
Practical Uses
Social Media apps such as Instagram use APIs and need high security. It would be a big problem if they had venerable APIs that allowed everyone’s data to be leaked.
Conclusion
In summary, APIs are the foundation of our interconnectedness. Without APIs, we most likely would not be able to communicate- or literally do anything on the internet.