DEV Community

Ajay Krupal K
Ajay Krupal K

Posted on • Edited on

API? What?

Most of us might have heard of the word API a lot in the tech world, such as Twitter API, Notion API, Google API and so on. So it’s time to debunk what an API is.

API stands for Application Programming Interface. It usually refers to REST API where REST stands for Representational State Transfer. API works just like a website where a call from the client (user) is sent to the web server and data is received back over the HTTP Protocol. While a website returns back a Graphical Output, an API usually responds back in a specific format such as JSON data.

GitHub Website vs GitHub APIPicture depicting GitHub Website vs GitHub API

You can always access an API, take it’s data and pass it into another API and build some thing great. In a way that we can read data from API, we can similarly send data to an API. Before that we need to know what HTTP Request Methods are. There are two main HTTP Request Methods, GET and POST. GET method allows you to send a request to the API and receive back a response in a format such as JSON. POST method allows you to write data to the API and can be best done by mentioning the data in the body of the request. This cannot be accomplished within a browser instead we can use a software known as POSTMAN [https://www.postman.com/]. But to write data to a public API, the API owners usually require Authentication, and the most commonly used authentication is OAuth. An OAuth basically takes credentials in the form of username and password in exchange for an access token which needs to be passed to the API which lets you securely access the API and write to it. Suppose you want to send out a tweet using the Twitter API, you can get the access token of the Twitter API, and then use this access token to send out a tweet from Postman.

If you find this article useful, please feel free to like and comment.

Top comments (0)