You might use, or at least know about, the M-Bus mobile application. If you look at the user interface carefully, you’ll notice that it looks very similar to Google Maps, and it tracks where the buses are in almost real-time! How does it retrieve Google Maps data, and how does it display live bus locations? Hint: the title of this page.
Application programming interfaces, or APIs, are crucial for web development that requires any dynamic data retrieval.
An API is an interface, a set of definitions and protocols. Developers use this interface to build programs and applications, hence the name. A key functionality of an API is letting external applications communicate with each other by exposing limited amounts of internal data.
This means that an API does not have to be web-based. Non-web-based APIs can be implemented using JAR files for Java applications and header files for C and C++ code. We call these “web-based” APIs because they communicate over the Internet.
Many web application developers use web-based APIs to help them create applications that can fetch data and push changes. This makes these applications dynamic. This is in contrast to static websites, websites built solely with HTML and CSS. You can’t implement features such as user authentication without retrieving data from a server.
Fetching data and pushing changes are two examples of actions commonly grouped into the CRUD acronym.
CRUD is an acronym for Create, Read, Update, and Delete. These four actions are very commonly used in web application development.
These actions are generally requested by the client (the app you are using), and the server will take that request and process it. The communication between the client and server is done via an API.
Since most of the web communicates via HTTP, we need to conform to this standard. This means that a client will send an HTTP request to the server, and the server will process that and send back an HTTP response. HTTP requests can tag themselves with with a request method to indicate to a server of an incoming action. Here are the four request methods that are analogous to CRUD.
GET → Read
POST → Create
PUT → Update
DELETE → Delete