What are APIs?

What are APIs?

Introduction

Handshakes. The shaking of hands. An exchange of information between a client and a server.

That's the definition of APIs that stuck with me, anyway. Walk with me.

In programming, you'd come across APIs in your career. Probably more than you'd like to, so it is important to know what they are, and how to work with them.

This article focuses on 'what they are'.

APIs stand for Application Programming Interface(s).

It is the way various programs, interact with each other and tell each other what to do and how to do them. It's the way they communicate with each other. In more technical terms, a client sends a request to the server and the server gives a response. This response could be to let the client know the request was successful, or there was an error.

Types of API requests:

Various API requests exist, but these are the most popular ones:

  1. A GET request: As the name suggests, this type of request is trying to get (retrieve) information from a server. You just indicate the URL the information you want is available on, and the required parameters to access the information, and the server returns the information you need.

  2. The POST request: This type of request creates information, and adds (posts) it to a server. If successful, the server returns a response to let the user know, if not, an error message is returned.

  3. The PUT request: You've made a post request, but need to make changes, with the right parameters and URL, you just send the new data, and it'd update the old information.

  4. The DELETE request: This means you want to delete already existing data from the server. If the request is successful, you get a response affirming that your request was successful. On the other hand, If you try deleting a resource that does not exist, you get an error message.

  5. The PATCH request: This is very similar to PUT request. The major difference is that instead of updating the whole information on the server, it just updates a particular property/section of the information available.

So, that's it. A summary of the different kinds of API Requests that exist.

Here are some links to explore how to use these APIs in different languages:

Good luck with your learning!

I hope next time when you hear or come across them, you know exactly what they mean and the kind of request being made.

See you next time!

Connect with me on Twitter: @preshh0

Connect with me on LinkedIn: Precious Onyewuchi