What Is an API? The Answer in 300 Words or Less

By kbodnar@hubspot.com (Kipp Bodnar)

Twitter API reference index

When the marketing industry first shifted from outbound to inbound marketing, many marketers dropped their old roles of content interrupters for new ones as content creators.

But that shift is still producing aftershocks, and to keep up with your competitors today, you need to understand what APIs are, how they integrate with your content strategy, and the social insight they bring to your website.

Don’t worry — APIs might seem complicated, but by the end of this post, you’ll know how they work and what using them entails.Here’s a brief definition of an API, followed by some key information on how to make one work for your business.

What is an API?

An API, short for application programming interface, is a series of rules. To be even clearer, it is an information middleman. APIs allow for an application to extract information from a piece of software and use that information in their own application, or sometimes for data analysis.

In the plainest terms, an API is a blueprint that enables “your stuff” to talk to and work with “their stuff.” Your stuff, in this case, is known as the API endpoint.

Sound confusing? Don’t worry — we’ll walk through an example below.

API Endpoint Example

Let’s say you want to stream public tweets in real-time so that you can stay informed on a specific topic of interest or on current trends in the world. Then you could use Twitter’s filtered stream endpoint. Its URL is: https://api.twitter.com/2/tweets/search/stream

Technically, an API endpoint need only be referred to with the end path of the resource URL. The base path, which is common to all endpoints, is https://api.twitter.com. Because that stays the same, there’s no need to keep listing it. You can instead just list the endpoint: /2/tweets/search/stream.

How to Test an API Endpoint

There are several online tools available for testing an API endpoint. For the sake of this post, we’ll walk through how to set up a test using cURL. cURL is a command-line tool for transferring data that supports multiple protocols, including HTTP. It is able to make requests, get data, and send data — making it the perfect tool for requesting information from APIs.

Let’s use an example from Twitter’s own documentation. Say, you want to stay informed on the Twitter API. Then you will want to get tweets from major accounts like @TwitterDev and @TwitterAPI as soon as they’re posted. And maybe you only want tweets that contain links to articles or documentation so you’re getting as much context as possible.

In that case, using the filtered stream endpoint is the perfect choice. But in order for the endpoint to know what kind of tweets to send you, you’ll have to define filtering criteria. Otherwise, you’d just be asking to see every tweet posted in real-time.

Filtering criteria will be applied to the endpoint in the form of rules. To build these rules, you’ll need a set of operators. For …read more

Source:: HubSpot Blog

      

Aaron
Author: Aaron

Related Articles