Foamy on the Outside, Structured on the Inside: Learning APIs with Breweries

Dillon Mantle
August 1, 2025

As a data engineer, one of your most essential skills is knowing how to interact with APIs. APIs are crucial for ingesting data from countless sources, building robust data pipelines, and integrating different systems. They are the digital conduits that allow you to fetch the raw materials for your work.

This tutorial will give you firsthand experience by walking you through a real-world example using a fun, free dataset.

What is an API?

An API, or Application Programming Interface, is a set of rules and protocols that allows different software applications to communicate with each other. It defines the methods and data formats that applications can use to request and exchange information.

Think of it like this: you are at the Jolly Roger and want to know what's on tap. Instead of going behind the bar yourself, you ask the bartender (the API) for the beer list. The bartender then gives you a structured menu (the data) that you can read. In our case, our program will ask the Open Brewery DB's API for data, and the server will return it in a clean, predictable format.

Our Lesson: Tapping into the Open Brewery DB

To celebrate the craft of brewing, we'll be using the Open Brewery DB, a community-driven API that provides public information on breweries, cideries, and brewpubs. It's the perfect dataset for learning how to request, retrieve, and process data from an external source - a core task for any data engineer. So, let's get started!

Making Your First API Call

Let's start by getting a list of breweries. We'll use Python and the popular requests library - All code can be found on Google Colab

The base URL for the Open Brewery DB API is https://api.openbrewerydb.org/v1/breweries. We can send a GET request to this URL to retrieve a list of breweries.

This code will print the names of the first five breweries returned by the API.

Processing the API Response

The response from the API is in JSON (JavaScript Object Notation) format, which is easy to work with in Python. The response.json() method automatically converts the JSON response into a Python list of dictionaries, where each dictionary is a brewery.

Each brewery dictionary has a wealth of information, including:

  • The name of the brewery.
  • The type of brewery (e.g., micro, brewpub, regional).
  • The street address.
  • The location of the brewery, including the city, state/province, postal code, and country.
  • Contact details such as phone numbers and website.

Let's say we want to find all the microbreweries in a specific city, like "San Diego." We can do this by adding parameters to our API request.

This will give you a list of up to five microbreweries in San Diego. You can easily change the params dictionary to filter by state, name, or other fields.

A More Advanced Example: Searching for Breweries

The Open Brewery DB API also has a powerful search endpoint that lets you find breweries by a search term. This is useful when you don't know the exact name of a brewery but have a keyword in mind.

Let's search for breweries with "Agars" in their name, just to see if a South African favourite has made the list.

This will return a list of breweries that match the search term "agars", and we can see that South Africa has not yet made the cut.

Cheers to Data 🍻

And there you have it! You've learned how to consume and process data from the Open Brewery DB API. This is just the beginning, of course. You can use this data to:

  • Build a map of breweries in your area.
  • Analyse the most common brewery types.
  • Create a web app to help people find their new favourite brewery.

The possibilities are as endless as the variety of craft beers out there. So, this International Brewing Day, raise a glass to the power of data and the joy of a good brew.

Cheers!

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Leave a reply

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Get ready for the future.

Need more?

Do you have an idea buzzing in your head? A dream that needs a launchpad? Or maybe you're curious about how Calybre can help build your future, your business, or your impact. Whatever your reason, we're excited to hear from you!

Reach out today - let's start a coversation and uncover the possibilities.

Register for our
Free Webinar

Can't make BigDataLondon? Here's your chance to listen to Ryan Jamieson as he talks about AI Readiness

REGISTER HERE