API is an Application Programming Interface, which is, when you say it in reverse, an interface you can program against in an application.
Say you wish to render a picture of a cat on the screen. You would interact with the display subsystem through its API, where you would make function calls against its API to display pixels in the way you want and where you want on the screen. Or if you want to shoot a gun in a video game, you might make an API call to fire toward position x,y and the internal code for the game would do all the calculations and work to make that happen.
The whole point is to do the work for you, so you can just use various libraries and interact with them through their API to get things done, so you don’t have to write all the low level code yourself.
HTTP is HyperText Transfer Protocol. It is “like” an API, in which you’re interacting with a service (which is a program running in memory and listening on a network port) where that protocol allows you to request web pages, post web pages, delete web pages, pass data back and forth, and such things.
Reddit has an API, which uses something called REST, which uses HTTP calls to interact with the reddit subsystem so you can program tools to programmatically interact with reddit (comment, post, moderate subreddits, etc.) without you having to code all that yourself.
An API is usually thought of more interacting with something on your local machine like a .dll library of code that allows you to use prebuilt code, and HTTP is interacting with a web service to interact remotely.
At a high level, they’re identical in concept, at lower levels, the actual mechanisms are different.
Latest Answers