Skip to content

A cross-platform solution for all of Systembolaget's open APIs. For up-to-date data see https://github.com/AlexGustafsson/systembolaget-api-data.

Notifications You must be signed in to change notification settings

AlexGustafsson/systembolaget-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Systembolaget API

A cross-platform solution for fetching closed and open Systembolaget APIs.

The utility is an easy to use way of fetching Systembolaget's open and closed APIs. It's written in Go and is available via several cross-platform builds.

It's usable both as a library in Go and as a standalone utility for which you can find release builds here.

Quickstart

Using as a utility

Start by grabbing the latest release for your platform from the releases.

Search for beers produced in Sweden that were recently put up for sale.

systembolaget assortment --category "Öl" --origin "Sverige" --sort-by "ProductLaunchDate"

Get the names of Sake with a sweetness of between 5 and 12.

systembolaget assortment --taste-clock-sweetness 5,12 --category Vin --subcategory Sake | jq -cr '.[].productNameBold'

Get the names of non-alcoholic beverages in glass bottles.

systembolaget assortment --alcohol-percentage 0,0 --packaging-category Flaska --limit 5 | jq -cr '.[].productNameBold'

Download the full assortment.

systembolaget assortment --sort-by "Name" --ascending

Fetch all stores.

systembolaget stores

An excerpt from the results is shown below. For samples, see the samples directory.

{
  "productNameBold": "Melleruds",
  "productNameThin": "Utmärkta Pilsner",
  "alcoholPercentage": 4.5,
  "assortmentText": "Fast sortiment",
  "bottleText": "Flaska",
  "categoryLevel1": "Öl",
  "categoryLevel2": "Ljus lager",
  "categoryLevel3": "Pilsner - tysk stil",
  "color": "Gul färg.",
  "country": "Sverige",
  "customCategoryTitle": "Öl, Ljus lager, Pilsner - tysk stil",
  "tasteClockBitter": 6,
  "tasteClockBody": 6,
  "tasteClockCasque": 1,
  "tasteClockFruitacid": 0,
  "tasteClockSweetness": 1,
  "tasteSymbols": ["Fläsk", "Fisk", "Buffémat", "Sällskapsdryck"],
  "usage": "Serveras vid 10-12°C som sällskapsdryck, till buffé eller till rätter av fisk eller ljust kött. "
 // ...
}

Using as a library

Add the necessary import.

import (
 "github.com/alexgustafsson/systembolaget-api/v3/systembolaget"
)

Create a client.

client := systembolaget.NewClient(apiKey)

Perform a search for a light lager that goes with meat.

res, _ := client.Search(
 ctx.TODO(),
 &systembolaget.SearchOptions{
  SortBy:        systembolaget.SortPropertyScore,
  SortDirection: systembolaget.SortDirectionDescending,
 },
 systembolaget.FilterByCategory("Öl", "Ljus Lager", ""),
 systembolaget.FilterByMatch("Kött"),
)
fmt.Println(res.Products)

Table of contents

Quickstart
Use cases
Contributing

Use cases

The utility can be used to automatically grab the latest available data from Systembolagt. The data can be used to create interesting statistical charts, archives and more. Note however that data derived from the platform should not be used in a way that goes against Systembolaget's mission.

For archived data, please refer to https://github.com/alexgustafsson/systembolaget-api-data.

Contributing

Any help with the project is more than welcome.

Building

# Build
make

# Format code
make format

# Lint code
make lint

# Vet the code
make vet

# Run tests
make test