Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

bolaget.io (https://bolaget.io)

Build Status

This API has nothing to do with Systembolaget, this app consumes a large XML API from Systembolaget and transforms it into a REST JSON API. More info can be found here: http://www.systembolaget.se/api

Flowchart

Flowchart

Versions

Please have a look at CHANGELOG.md for more information. Otherwise this project adheres to Semantic Versioning.

Version Url
v1 https://bolaget.io/v1

All resources will be available without versioning in the url and be an alias for the latest API version.

Products

GET /products
Host: bolaget.io
  • URL Params

    Optional:

    limit=[number] - Default limit is 10, max limit is 100

    offset=[number]

    ecological=[bool]

    koscher=[bool]

    ethical=[bool]

    year_from=[number]

    year_to=[number]

    sales_start_from=[date] - YYYY-MM-DD

    sales_start_to=[date] - YYYY-MM-DD

    price_from=[number]

    price_to=[integer]

    volume_from=[integer]

    volume_to=[number]

    assortment=[alphanumeric] - BS = Reservation assortment, TSE = Temporary assortment, FS = Regular assortment and FSN = Regular assortment (new product), TSLS = Locally produced

    assortment_text=[alphanumeric] - Ordervaror = BS, Fast sortiment = FS, Tillfälligt sortiment = TSE, Fast sortiment = FS/FSE, Lokalt & Småskaligt = TSLS

    sort=[alphanumeric] - Property to sort by, accepting:

    • price:asc|desc
    • price_per_liter:asc|desc
    • volume_in_milliliter:asc|desc
    • sales_start:asc|desc
    • year:asc|desc
    • zip_code:asc|desc
    • name:asc|desc

    name|type|style|provider|producer|origin|origin_country|packaging|product_group|sealing|commodities=[alphanumeric] - Fuzzy match

    search=[alphanumeric] - Fuzzy search in several fields

  • Response headers:

    X-Total-Count=[number] - Total count of products based on filtering used for pagination

  • Success Response:

    • Code: 200
      Content: [{ name: '117 Grythyttan' ... }] or []
  • Error Response:

    • Code: 500 INTERNAL SERVER ERROR
      Content: { error : "Ouch, an ugly error has occured!" }

Product

GET /products/:nr
GET /products/:article_nr
Host: bolaget.io
  • Success Response:

    • Code: 200
      Content: { nr: 12, name: "117 Grythyttan" ... }
  • Error Response:

    • Code: 500 INTERNAL SERVER ERROR
      Content: { error : "Ouch, an ugly error has occured!" }

    OR

    • Code: 404 NOT FOUND
      Content: { error : "Move along, nothing to see here!" }

Stores

GET /stores
Host: bolaget.io
  • URL Params

    Optional:

    limit=[number] - Default limit is 10, max limit is 100

    offset=[number]

    labels=[alphanumeric] - Takes a comma separated list, eg. norrbotten,jämtland, returns documents containing all labels matched (fuzzy)

    sort=[alphanumeric] - Property to sort by, accepting:

    • RT90x:asc|desc
    • RT90y:asc|desc
    • address:asc|desc
    • city:asc|desc
    • county:asc|desc

    type|name|city|county|address=[alphanumeric] - Fuzzy match

    search=[alphanumeric] - Fuzzy search in several fields

  • Response headers:

    X-Total-Count=[number] - Total count of stores based on filtering used for pagination

  • Success Response:

    • Code: 200
      Content: [{ adress_1: 'Kungsholmstorg 11 A' ... }] or []
  • Error Response:

    • Code: 500 Internal Server Error
      Content: { error : "Ouch, an ugly error has occured!" }

Store

GET /stores/:nr
Host: bolaget.io
  • Success Response:

    • Code: 200
      Content: { address: "Vasagatan 25", ... }
  • Error Response:

    • Code: 500 INTERNAL SERVER ERROR
      Content: { error : "Ouch, an ugly error has occured!" }

    OR

    • Code: 404 NOT FOUND
      Content: { error : "Move along, nothing to see here!" }

Development environment

Kubernetes

You need a local Kubernetes cluster (minikube, docker-for-mac etc.) with helm installed.

Build:

make build

Install:

helm install \
  -f chart/values.yaml \
  -f chart/values-dev.yaml \
  --set web.image.tag=local \
  --set web.image.pullPolicy=Never \
  --name bolagetio \
  ./chart

Docker Compose

Using Docker and Docker Compose (https://www.docker.com/)

Build

  • docker-compose build

Start

  • docker-compose up web

Start worker

  • docker-compose run --rm web npm run dev:worker

Run tests

  • docker-compose run --rm web npm test

About

RESTful(ish) JSON API for Swedish alcohol monopoly, Systembolaget. Running on preemptibles on k8s! 🚀🍺

Topics

Resources

License

Releases

No releases published
You can’t perform that action at this time.