Confused about APi term

I never quite understood the definition of "API", it's been years now For me in the beginning, it was fetching data from some server like twitter api, discord api, and reddit api, API acts the bridge. But then in MDN docs, some stuff (maybe methods i dont remember) is declared as API. Also, now im reading about promises, its called an API too: https://davidwalsh.name/promises Please help me with this doubt
The JavaScript Promise API... XMLHttpRequest API Battery API Fetch API (this does makes sense to me coz we fetch data and manipulate it)
what even is an API?
11 Replies
ἔρως
ἔρως3mo ago
api is a broad term it just means "application programming interface"
brr
brrOP3mo ago
i cant understand it for other stuff like Promises how is "JS Promises" an api?
MarkBoots
MarkBoots3mo ago
Commonly we use the term api for interaction with backend servers. That's what you are thinking of right now. but it could be also something to connect to via browser, window, local machine or whath ever. you dont know what is happening internally with all those services, but it is made easier for by having an interface that exposes a set of methods or properties to call/use Fetch API → interact with servers Promise API → interact with async values DOM API → interact with HTML Twitter API → interact with Twitter data
ἔρως
ἔρως3mo ago
it's not just that: it defines a way on how you interact with the thing or how the thing will behave for example, the dom api exists in php too, and it is really close to what exists in js and others that use the dom model should work mostly the same another example, with twitter, you can have a rest api and that, yes, describes how the server-side works and a strusture it should follow the promise api does stuff with the scheduling, but you can only use it with the methods that exist same for the accelerometer, serial, bluetooth, webgl/webgpu
MarkBoots
MarkBoots3mo ago
i do understand the confusion of OP. Normally you hear people say. 'Does it have an api?" but then we are talking about controlling data from a different source or such We don't really use the term for things that are directly accessible, like in the application we work in.
ἔρως
ἔρως3mo ago
yeah, but "api" behaves more like a concept than something defined in strict rules like the concept of color in general
13eck
13eck3mo ago
API stands for "application programming interface" and is a fancy way of saying, "this is the contract we agree to for you to intereact with [something]". So the fetch API is how you interact with fetch requests. The DOM API is how you interact with the document object model. The Twitter/Discord/Reddit/etc (REST) API is how you interact with that service via REST. Which is another topic that is wildy misused—even the person who created the idea says the way 90% of people use it is wrong 🤷
ἔρως
ἔρως3mo ago
and if you want to confuse things even more, there is abi - application binary interface which is the set of methods/functions and data that a binary exposes and expects you to use
brr
brrOP3mo ago
ahhhhhhhhh Thank you Yes, I was thinking about backend
Tim Rinkel
Tim Rinkel3mo ago
One thing to help understand "why API?" is that it is a computer industry term dating back to the late 60s and the "idea" existed long before that. It is simply an established set of rules for communicating between modules. Those modules can be full applications or parts of applications. Software or hardware. When you expand the term beyond the realm of web development, the way it is used in web development makes more sense. — For a good explanation (if you want a deep-dive) see this Wikipedia article (which is where I got a couple of the specifics—and to make sure I knew what I was talking about).
API
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software interface, offering a service to other pieces of software. A document or standard that describes how to build such a connection or interface is called an API specification. A computer system that meets this standard...
ἔρως
ἔρως3mo ago
this sounds ai generated, but pretty accurate

Did you find this page helpful?