eli5 – What does an API & HTTP call mean? And what is the difference between both and their significance ?

262 views

eli5 – What does an API & HTTP call mean? And what is the difference between both and their significance ?

In: 3

5 Answers

Anonymous 0 Comments

An API is a structured way for one program, or part of a program, to communicate with another. The reason we use APIs is so that one program can change without having to update the other: all program A has to do is make sure its API stays unchanged, and program B can keep working with it, even if program A’s internals are changed.

A common use for APIs is on a web server – a program that is listening for requests from the web. It’s typical for such APIs to be accessed by accessing some specific web address. For example, for a Reddit bot to post a comment to Reddit, it sends a POST request (a specific type of web request) to reddit.com/api/comment with information in a [particular structured format](https://www.reddit.com/dev/api#POST_api_comment). Reddit’s server knows how to understand this format, and can pass it on to Reddit’s internal logic to create a post. Each of these special addresses is called an *endpoint*, and we say that Reddit’s API *exposes* an endpoint for posting comments.

HTTP is a standard for communicating over the web. It contains a few types of message (GET and POST, for requesting and sending[+possibly requesting] information, are the two most common) in a particular format. In the above Reddit comment API, for example, you send a POST request (i.e., you’re sending information, not just asking for it) that contains, among other things, the content of the comment you want to post.

You are viewing 1 out of 5 answers, click here to view all answers.