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

1

u/scandii Mar 26 '20

I feel people are giving you really long word salads of responses worthy of a wiki article.

an API is simply a program located behind an address somewhere that takes data. say you send the data "hello there" to an API located at myapi.com/myapi, it takes the data and if programmed to do so returns the data "general Kenobi".

that's it.

there's of course a bazillion layers of complexity on top of this but all we're doing is sending data (called payload in API lingo) and getting responses.

the reason we do this is so that we can ask other software about things like getting weather data from a weather service.

1

u/nutrecht Mar 26 '20

an API is simply a program located behind an address somewhere that takes data.

An API doesn't have to be a web API. While it's common nowadays, it's definitely not the only use of the work.

1

u/scandii Mar 26 '20

unlike popular belief address is not equal to web.

1

u/nutrecht Mar 26 '20

An API can also be a DLL for example. There doesn't have to be any 'address'.

1

u/scandii Mar 26 '20

a DLL still has an address to where it's located at.