What are APIs and how do they work?
Anyone who works with business software has heard terms like “API” and “webhooks” thrown around. In this article, we’ll not only cover what APIs are, but we’ll also answer the question: “How do APIs work?” Understanding the function of APIs is the key to understanding how they can help business users in any role accomplish more, faster - without necessarily having to learn coding.
API tools have fundamentally transformed how developers write applications. They have introduced an entirely new vertical of “platform as a service” software companies. API-based tools are the reason why data integrations between essential business software are possible. In fact, API integrations have become essential to operations and revenue professionals.
API stands for “application programming interface.” An API is essentially a set of rules that dictate how two machines talk to each other. Some examples of API-based interactions include a cloud application communicating with a server, servers pinging each other, or applications interacting with an operating system. Whenever you use an app on your phone or computer or log onto Twitter or Facebook, you’re interacting with several different APIs behind the scenes. Nearly all businesses that use any kind of modern technology use APIs at some level to retrieve data or interact with a database for customers to use.
An API’s defined communication protocol is what enables developers to build, connect, and integrate applications quickly and at scale. Consider, as an example, Jeff Bezos' famously-issued 2002 mandate. Amazon's change of direction shows how APIs helped it move faster than its competitors, and is reportedly the reason Amazon is so successful. Bezos ordered all of his teams to communicate and expose data and functionality through service interfaces, that is, APIs. Once the APIs and infrastructure were in place, Amazon’s teams were able to operate much more efficiently. Launching this new infrastructure enabled the creation of Amazon Web Services, which has since become Amazon’s largest revenue driver.
Amazon’s decision to move to service interfaces enabled the launch of AWS.
Some businesses don't just employ internal APIs, which their engineers use to build features for their consumers. Many companies also use external APIs, which the developer community uses to launch products. Some examples include Twilio (communications API), Stripe (payments API), and Sendgrid (email API), which offer a “Platform as a Service” (PaaS) model. Such companies enable developers to build applications on their platform, which might perform functions such as hosting web servers or communication applications. There are businesses whose main value comes from connecting different APIs and web services, which are categorized as “Integration Platform as a Service.” IPaaS companies let users connect disparate web services and tools, most notably to route data or automate workflows. Both of these verticals have grown tremendously, fueled by the extensibility and ease of use of APIs.
APIs have played a critical role in shaping modern business by enabling automation. But how do APIs work? And more importantly, how can you use them to connect the services that you rely on to route data or automate critical workflows?
How do APIs work? And how do they help you do more every day?
An application programming interface is a set of rules that define how computers, applications, or machines can talk to each other. You can think of it this way: the typical user interface is intended for use by a human being, while APIs are intended for use by an application or computer.
Most web APIs sit between the application and the web server. The user initiates an API call that tells the application to do something, then the application will use an API to ask the web server to do something. The API is the middleman between the application and the web server, and the API call is the request. And every time you use software to communicate with other software or online web servers, you’re using APIs to request the information you need.
It’s important to note that while web APIs are the most common, APIs aren’t limited to the web. There are APIs for virtually every machine or system that expects to interact with other machines or systems.
How do APIs work? An abstraction
Let’s use a metaphor to explain how an API works.
Imagine you’re a customer at a restaurant. The waiter (the API) functions as an intermediary between customers like you (the user) and the kitchen (web server). You tell the waiter your order (API call), and the waiter requests it from the kitchen. Finally, the waiter will provide you with what you ordered.
The waiter is the intermediary between you and the kitchen. In this metaphor, the waiter is effectively an abstraction of the API. In software engineering, an abstraction is a fundamental concept that aims to simplify a complex mechanism by only focusing on the details of higher importance. In this example, as a customer, you don’t need to know how the kitchen or the restaurant operates in order to get what you want: the food. You just need to know how to order it.
An API is also an abstraction of the web server. The application (such as a website or a mobile app) will make an API call for a set of data to display for the end user to consume. The request is made via the API that accesses the web server to retrieve the requested data, which is populated in the user interface.
Note how abstractions are evident at every “level” of the web application. The application doesn’t need to know how the web server works, just how to use the APIs to get the data it needs to display. The end user doesn’t need to know how the APIs work, just how to navigate the user interface to perform the tasks she needs to perform.
In most API requests, there are often a few key pieces of information:
- Type of request
- Authorization credentials (to prevent mimicked API calls from any attacks on the server)
Types of APIs
The most common discussion you’ll hear about APIs tends to focus on web technologies, but APIs aren’t limited to web services. Here’s a roundup of common (and not so common) APIs.
*How do REST APIs work?*
REST, or “representational state transfer,” is a type of software design that gives access to data (aka “web resources”) by using a uniform and predefined set of operations. The payload - the data to be delivered - defined in the request itself, will be formatted in a language such as HTML, JSON, or XML. The set of operations are the methods available to HTTP, which is the underlying protocol for how browsers retrieve websites from servers. These methods include GET, POST, PUT, DELETE, and others.
There are four parts of a REST API request:
- URI (uniform resource identifier, which is the URL address, also known as an “endpoint”)
- HTTP method (most commonly either GET or POST)
- Headers (which include authentication tokens, define the data format of the response, impose rate limits, and perform other administrative tasks)
- Body (the actual part of the request)
SOAP, or “Simple Object Access Protocol,” is a bit more complex than REST because it requires more information upfront about security and how it sends messages. These additional standards require more overhead, and as a result, SOAP - an API standard that has been around since the late 1990s - tends to lack the lightweight portability and flexibility of REST.
Similar to browser APIs, each mobile platform has its own set of APIs that provides developers the tools to build experiences for their end users. App developers can use these APIs to transmit data to the device’s hardware, use a sensor from the hardware such as a camera, play music or video, or perform many other capabilities.
What is the API economy?
Since APIs act as an abstraction for developers, they play a crucial role in the scalable nature of software development. Any developer who knows how to access a REST API, for example, is now immediately capable of integrating payments (Stripe), SMS/VoIP (Twilio), and email (Sendgrid) into their applications. APIs turn complex processes, such as payments, into a few lines of code, fundamentally amplifying developer productivity. What once took developers a few weeks to build can now be done within a few minutes thanks to APIs.
The API economy is driven by a new class of businesses who provide public access to their APIs (also known colloquially as “devtools,” shorthand for developer tools), such as Twilio, Sendgrid, and Stripe. These devtool API providers aim to drive developer productivity by tying together complex functionalities with a REST API. Tying together functionalities with APIs has componentized and modularized most common operations you’d expect from web or mobile apps. This means that thanks to APIs, developers can easily build formerly complicated operations such as payments, mapping, transportation, and ride-sharing directly into their apps. As more API providers enter the marketplace, the API economy is trending towards applications that are built mostly with APIs.
Single-handedly driving modern business innovation: the webhook
Due to the proliferation of APIs, modern businesses now rely heavily on them for data and web automation. For example, many revenue and customer-facing teams use tools (which are built on APIs) for lead-to-account matching between a CRM like Salesforce and a marketing automation tool like Marketo. Savvy SaaS vendors, aware of their responsibility within the bigger picture of their customers’ tech stacks, enable data exports via an API endpoint to help their customers run analysis across all of their data sources to get a complete and holistic view of their customer journeys.
Prior to the API economy, it was common for businesses to stick to a single vendor’s product suite for a CRM, marketing automation, and other apps on the assumption that it would be easier to pass data among them. Thanks to APIs, teams can instead use a “best-of-breed” approach to selecting vendors that empower their teams. By taking advantage of the way APIs enable software apps to talk to other software apps, teams can use the best CRM suited to their needs, the best marketing automation platform for their needs, and so on.
Learn more about webhooks in our in-depth guide.
But how does the data sync between tools work? If we peel back the technologies in an integration between cloud tools, we’ll find that they’re all built upon another REST API concept: the webhook. It’s a simple yet effective method to deliver or “push” data in real-time.
In fact, when it comes to accessing data between tools, in the absence of a dedicated integration, most vendors will offer a webhook. Consider this scenario: your team wants custom real-time status notifications on performance data from a different tool or simply wants to export data out of that tool (usually one row or record per webhook). You can enable the tool to deliver an API call (usually a JSON payload) to a URL endpoint that you provide.
In order to parse the inbound JSON payload, your endpoint should be on a server that you have access to or another tool that has specifically built a webhook ingestion endpoint. Once you have received the webhook, you can transform this data and save it to a data repository of your choosing (a popular choice of data repository is a data warehouse like Redshift for analysis), or if the webhook is a notification, you can programmatically trigger any action you desire: such as sending an email or a text or creating a calendar event. The flexibility and simplicity of webhooks has helped them become the basis of modern web automation. Learn more about webhooks and real-world automation examples.
What are the benefits of APIs?
APIs are all over the web, and are therefore common in modern business. Due to their ease of use, there’s been a huge increase in API usage among platform and infrastructure businesses. On top of that, APIs enable users to integrate apps like Salesforce, Eloqua, and Marketo to better integrate their lead routing. It’s important for revenue teams to flow lead data between their marketing platform and CRM, and for customer support teams to flow data between their helpdesk and payment processing system to manage renewals, upsells, and churn.
The best platforms for working with APIs make use of their power and flexibility by letting users port over data from custom fields, which is a real pain point, even for software with out-of-the-box integrations. For example, Marketo and Salesforce offer native integrations, but since every sales organization designates their CRM fields differently, this integration typically isn’t up to the task of keeping up with every custom field. Modern API-based tools, such as the Tray Platform, give users the ability and flexibility to map custom fields between different apps, and even flow data directly between them via API calls. Providing this power saves a ton of time and prevents manual errors, while freeing up users to focus on more-important strategic concerns, such as how to grow customer engagement or win more sales deals.
APIs have been a game-changer for modern software. The rise of the API economy not only enables software companies to rapidly build in key functionality that might previously have taken months or years of coding to implement, but it has also enabled end users to connect their best-of-breed apps and flow data freely among them via API calls.
Modern companies make the most of their cloud apps’ APIs to rapidly and automatically deploy mission-critical data across their tech stack, even from custom fields that don’t work with out-of-the-box integrations. FICO used API integrations and automation to grow engagement for its marketing campaigns by double digits. AdRoll used automated API calls among its revenue stack to increase sales meetings 13%. Learn how you can put the power of APIs on your side by joining a weekly group demo.