OpenBreweryDB Public API Documentation

OpenBreweryDB is a public API that provides brewery information including the name, location, and type of brewery. This API is perfect for developers who are building beer-related applications.

API Endpoints

OpenBreweryDB provides several endpoints that allow you to retrieve information about breweries in various ways. These endpoints include:

  • /breweries: retrieves all the breweries in the database.
  • /breweries?by_city=city_name: retrieves all the breweries in the specified city.
  • /breweries?by_name=brewery_name: retrieves all breweries with the specified name.
  • /breweries/{id}: retrieves a brewery with a specific ID.

API Example in JavaScript

To use the OpenBreweryDB API in your JavaScript application, you need to send an HTTP request to the API. You can do this by using the fetch method.

Here's an example of how to retrieve all the breweries in the database:

const url = 'https://api.openbrewerydb.org/breweries';

fetch(url)
  .then(response => response.json())
  .then(data => {
    // Do something with the data
  });

Here's an example of how to retrieve breweries in a specific city:

const city = 'Los Angeles';
const url = `https://api.openbrewerydb.org/breweries?by_city=${city}`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    // Do something with the data
  });

Here's an example of how to retrieve a specific brewery by ID:

const breweryId = 777;
const url = `https://api.openbrewerydb.org/breweries/${breweryId}`;

fetch(url)
  .then(response => response.json())
  .then(data => {
    // Do something with the data
  });

Conclusion

OpenBreweryDB API is a great resource for developers who are building beer-related applications. With the available endpoints, you can retrieve brewery information in various ways. If you're building an application that involves beer, OpenBreweryDB is a perfect API for you.

Related APIs in Food & Drink