r/AskProgramming • • Mar 26 '20

APIs Explained ...

I dunno but I don't understand APIs fluently. Does anyone know of an informative article or perhaps a website or just personally explain to me frankly wtf APIs are an why we need them ...

Edit: Thanks everyone for your empathetic contributions. Guess what; I have a better understanding of APIs now than I did before.

53 Upvotes

60 comments sorted by

View all comments

128

u/Jrobah Mar 26 '20

API - Application Programming Interface. It is a way of allowing you to access the data from another application or a way of applications to communicate with each other.

Take the example of a restaurant, since it belongs to someone else and you are not allowed to go to the Kitchen therefore the menu is the API. Allows you to make an order for food. Food is like data which you request for. The order you make is called an API call. When you make an order, the waiter will give you a response eg the food is available or not. Same happens with APIs, when you make an api call, you will either get a successful response and get your data or get an error and no data.

Now you can refer to the more technical explanations given in the thread

13

u/cellwall-999 Mar 26 '20

Thanks Dude. This really makes sense.

Anyways, how about a rest/restful API or whatever ...? How is that different from an actual APIs?

12

u/frostbyte650 Mar 26 '20 edited Mar 26 '20

REST is the most popular way to design a web API

An API that follows the REST paradigm is considered “RESTful”

There are other ways to design a web API, such as SOAP, but unless you work with old web services, you’ll likely deal with REST

4

u/cellwall-999 Mar 26 '20

But, do APIs always need internet access to get data?

For example: I can view my account balance on my phone, send money and buy airtime from my account without having internet access or is these not an API at work?

Just curious...

2

u/YouDoNotKnowMeSir Mar 26 '20

API can be used in a lot of things. Web API will need internet access or network access depending on if you’re leaving your private network or not.

An example of an API that is used for software not web is android OS. Android OS has tons of system features and apps, they all talk to each other using an API. This is the glue for them, it’s what makes communication possible between their system and apps.