Interested in API access?

Thought my current project might be of interest to someone. I’ve just been working on a web service that returns the beverage data from taplist. Might be useful if you want to embed the data on another website. I’ve written it in JavaScript and deployed it to AWS so it’s accessible from anywhere. It is just a screen scraper so nothing fancy. Happy to leave it hosted there or share the code if that helps. Or maybe point a taplist subdomain at it. e.g. api.taplist.io.

Give me a shout if you want the URL.

The data it returns looks something like this:

{
  "taplistDetails": {
    "venue": "Electric Bear Brewing Co Taproom",
    "beverageList": [
      {
        "breweryName": "Electric Bear Brewing Co.",
        "beverageName": "Edison",
        "beverageStyle": "British Pilsner",
        "ABV": "4.8%"
      },
      {
        "breweryName": "Electric Bear Brewing Co.",
        "beverageName": "Howdy Ho",
        "beverageStyle": "American Brown Ale",
        "ABV": "5.1%"
      }
    ]
  }
}

Shout! I’d be interested in the URL.

I’m (over)anxiously waiting for Mikey to grant access to the “official” Taplist.io API in a few weeks. However, this may be a viable option for folks who don’t need API access to write to Taplist.io or who don’t want to pay for the official Taplist.io API access. The official Taplist.io API (along with other new features) will most likely be gated by a tiered (paid) subscription.

Joe

This is the URL at the moment:

https://cwhgp6hr8i.execute-api.eu-west-2.amazonaws.com/prod?venueID=123456

where you replace the venue id with the one you want. e.g. For the electric bear brewing company it’s:

https://cwhgp6hr8i.execute-api.eu-west-2.amazonaws.com/prod?venueID=670357

It’s just a lambda hosted on AWS so it’s a pretty horrible URL at the moment. So far it’s had very little testing but take a look and see if it would be helpful.

Comments welcome!

Pretty neat! It worked for me. I assume you’ll add support for the other fields.

I was trying to keep it as simple as possible rather than fully featured API access. I figured that you could embed the site in an iframe if you wanted all the data. This was written for a local venue so they could have a simple feed in a table on their own site and didn’t have to update the data in two places.

What other fields do you think would be useful?

  • Tap Number
  • Description
  • Rating
  • OG
  • FG
  • IBU
  • SRM

It looks like you’re assuming the presence of specific fields in a particular order. For example, if the taplist doesn’t include the beverage style, ABV ends up in the “beverageStyle” field,

     {  
        "breweryName":"Brewery Name 1",
        "beverageName":"Beverage Name 1",
        "beverageStyle":"ABV: 7.4%",
        "ABV":"Unknown"
     }

If the taplist doesn’t include the brewery name (i.e., producer) and includes the tap number, the tap number ends up in the “beverageName” field,

     {  
        "breweryName":"",
        "beverageName":"1.",
        "beverageStyle":"Beverage Style 1",
        "ABV":"100.0%"
     }

Most of the taplists I use follow a very basic format and so work ok. The website doesn’t have any easy way of getting the exact data out as it is just in a list on the website and so I’ve had to make some assumptions. The only exact way of sorting this would be to change the website to tag each entry with something. e.g “ID-BREWERY” “ID-ABV” etc. but I don’t have access to this code.

I’ve fixed the beverage style issue when there is no ABV but as there are so many fields there could be many more of these issue. I’ll take a look to see if I can fix the tap number one too.

What if your URL was to optionally accept an ordered list of “keys”,

https://cwhgp6hr8i.execute-api.eu-west-2.amazonaws.com/prod?venueID=123456&key={breweryName,beverageName,beverageStyle,ABV,tapNumber,description,rating,OG,FG,IBU,SRM,...}

This would tell you which fields to expect and the order in which to expect them.

Joe

Yeah that could work but then you would have to make sure that the two were in sync. And every beverage would then need to all have the same fields present. Hmmm…
IBU, OG, FG, SRM are simple to add. And will work with or without them. I’ve just added IBU for example.
I’ll have a play with tap number and brewery names when I have some time to see if I can make that work too. Watch this space… This is harder than I first thought!

It’s reasonable to think the consumer invoking your URL would know which fields are involved and their order.

That’s a good point. This would be a real challenge if your taplist involved a mix of beer, wine, mead, kombucha, root beer, …

In the case of ABV, SRM, IBU, OG and FG, the “key” explicitly appears in the HTML,

  <li><b>ABV:</b> 100.0%</li>
  <li><b>SRM:</b> 40.0</li>
  <li><b>IBU:</b> 100</li>
  <li><b>OG:</b> 1.000</li>
  <li><b>FG:</b> 1.000</li>

I’m sure that’s how you’re (now) parsing these fields.

Maybe you just specify whether the tap number, producer, style and description are present. I think it’s a reasonable restriction to assume if one beverage has a producer, style or description that all
of the beverages involve these fields. Certainly, if one beverage has a tap number then all beverages will have a tap number. And you may be able to infer whether a field is present based on the context. For example, the description is a paragraph,

<p>Free-form description of the beverage.</p>

(not sure if it will always be the only paragraph).

Again, I really like what you’ve done. I wouldn’t spend too much time implementing my crazy ideas. Let’s see what the broader community thinks.

Joe

Hey folks - it’s really neat to see some hacking here! Please do be aware that:

  • Scraping the site is likely to break unexpectedly at any time
  • An official API is well underway & coming soon

Don’t want to dampen your creativity but just want to make sure expectations are properly calibrated before you go too far.

I’ve already implemented OG, FG , SRM and IBU. Hopefully they should now be working. :slight_smile:

I’ll take a look at the other issues when I get a chance. Thanks for the input. This was originally just an excuse to have a play with AWS lambdas but thought it might have wider use. Really appreciate the feedback!

Thanks Mikey! Yeah definitely hacking! :slight_smile: Screen scraping is always going to be brittle. It’s fun to have a play around with though. Thanks for the heads up!

1 Like

Looking good. It seems to pick up ABV, SRM, IBU, OG and FG. In the event one or more of the fields is missing for a given beverage, the corresponding field contains “Unknown”. Very nice.

Joe

:+1: For what it is, it just about does it’s job. As Mikey said, it could break at any time and certainly couldn’t be relied upon. The only guaranteed solution is to use the official API once it’s released. Probably acceptable for personal use but not robust enough to be implemented on the Brewdog website. :slight_smile:

Hi Mikey,

is there an alpha or beta API available yet? I would love to embed the list of beers in our website if it is available…I would be happy test provide feedback or even pay some sort of subscription for it.

I’d be interested in the API. In particular I’d like to build an iOS app that access the data. I know there are cheaper options, but I already have the hardware and know-how :slight_smile:

@mikey I’m super interested in being able to use an API that would allow me to add new beverages to the beverage database, update the kegroom as well as updating the tap list. I already have code written that fetches beer information from other places, so it would be nice to be able to push info for new kegs into taplist.io from that.

I like the idea of the an API and even something I could manually integrate with a flow meter.