Beers API

Endpoints for searching, retrieving, and managing beer information in the database.

The Beers API provides endpoints for searching beers, retrieving detailed beer information, and managing beer data.

Endpoints

GET /api/v1/beers

Search and retrieve beers with advanced filtering options.

Query Parameters:

ParameterTypeDescription
querystringSearch term for beer name, brewery, or style
breweryIdstringFilter by brewery UUID
styleIdstringFilter by beer style UUID
productionCategorystringFilter by production category
minProductionYearnumberMinimum production year
maxProductionYearnumberMaximum production year
minAbvnumberMinimum ABV percentage
maxAbvnumberMaximum ABV percentage
minIbunumberMinimum IBU
maxIbunumberMaximum IBU
pagenumberPage number (default: 1)
limitnumberResults per page (default: 20, max: 100)

Response (200 OK):

JSON
{
  "success": true,
  "data": {
    "beers": [
      {
        "id": "uuid",
        "name": "Example Beer",
        "brewery": {
          "id": "uuid",
          "name": "Example Brewery"
        },
        "style": {
          "id": "uuid",
          "name": "IPA"
        },
        "abv": 6.5,
        "ibu": 60,
        "description": "A hoppy IPA",
        "imageUrl": "https://example.com/beer.jpg"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 150,
      "totalPages": 8
    }
  }
}

GET /api/v1/beers/:id

Retrieve detailed information about a specific beer.

Path Parameters:

  • id: Beer UUID

Response (200 OK):

JSON
{
  "success": true,
  "data": {
    "id": "uuid",
    "name": "Example Beer",
    "eanCode": "1234567890123",
    "brewery": {
      "id": "uuid",
      "name": "Example Brewery",
      "country": "Belgium"
    },
    "style": {
      "id": "uuid",
      "name": "Belgian Blonde",
      "category": "Ale"
    },
    "abv": 6.5,
    "ibu": 25,
    "description": "A classic Belgian blonde ale",
    "productionCategory": "commercial",
    "imageUrl": "https://example.com/beer.jpg",
    "createdAt": "2024-01-01T00:00:00Z",
    "updatedAt": "2024-01-01T00:00:00Z"
  }
}

Error Response (404 Not Found):

JSON
{
  "success": false,
  "error": "Beer not found",
  "code": "NOT_FOUND"
}

GET /api/v1/beers/search

Quick search for beers by name, EAN code, or brewery.

Query Parameters:

  • q: Search query (minimum 2 characters)

Response (200 OK):

JSON
{
  "success": true,
  "data": [
    {
      "id": "uuid",
      "name": "Example Beer",
      "brewery_name": "Example Brewery",
      "style_name": "IPA",
      "abv": 6.5
    }
  ]
}

Response Schema

Beer Object

FieldTypeDescription
idstringUnique beer identifier
namestringBeer name
eanCodestringEAN/UPC barcode
breweryobjectBrewery information
styleobjectBeer style information
abvnumberAlcohol by volume percentage
ibunumberInternational bitterness units
descriptionstringBeer description
productionCategorystringProduction category
imageUrlstringBeer image URL
createdAtstringCreation timestamp
updatedAtstringLast update timestamp

Brewery Object

FieldTypeDescription
idstringBrewery identifier
namestringBrewery name
countrystringCountry of origin

Style Object

FieldTypeDescription
idstringStyle identifier
namestringStyle name
categorystringStyle category

Error Codes

CodeDescription
NOT_FOUNDBeer not found
VALIDATION_ERRORInvalid request parameters
INTERNAL_ERRORServer error

Next Steps