An application programming interface (API), pronounced as three separate letters, provides a way for developers to interact with and share software resources programmatically. While developers can write each line of code from scratch, it’s far easier for developers to reuse code that’s already written. One way for developers to reuse code that’s already written is by using APIs.
APIs help developers organize code, make use of reusable components, and reduce code complexity. Developers have thousands of public APIs to chose from so they can leverage functionalities built by other developers.
Developers can write each line of code from scratch, but that can take a lot longer than reusing code that other developers have written. However, developers usually won’t offer up their proprietary code for other developers to copy and paste into their code. So instead of offering the code itself, developers offer up the functionality that the code produces. In this way, an API offers an abstraction of the underlying code.
As an example, you buy a new TV that comes with a cord to plug into a wall socket. The TV turns on when you plugin in the cord. You don’t know how TVs work. You don’t know how wall sockets work. All you know is that the manual says to plug the cord into a wall socket to turn on the TV, and voila, the TV works.
APIs work the same way as the cord and the wall socket. Developers don’t know how the code works. All they know is that the code works. Developers use the documentation for an API to figure out how to write their programs to leverage the functionality from other developers’ code.
Public APIs, also referred to as open APIs, are the outward-facing APIs that enable developers to share services and resources over the Internet. Before public APIs, developers built private APIs as a way to connect code components that ran on the same machine. Through the connectivity of the Internet, developers have been able to make their code available to other developers by building public APIs.
Public APIs aren’t always free. After all, developers spend a lot of time developing code, collecting data, and hosting the code and data to provide great resources and services.
Companies like Twitter, Google, and Salesforce build powerful public APIs that they offer to the public based on a freemium model. Using API keys, companies are able to uniquely identify customers who use their APIs. The keys enable companies to determine how many requests a developer makes so they can charge them appropriately based on their usage. In this way, an API key is a way of authenticating users to determine what they can do and how often they can do it.
HTTP status codes are transmitted by a server in response to a request from a client. The status codes indicate whether a request was...
A server is a computer that provides a service (such as providing data) to other computers and its users, known as the clients.