Export roast inventory as csv

Would like to be able to either export roast inventory data or else have access to it through an API.

What you are looking for might be this, available here in json format…

%appdata%\roast-time\containers

…on Windows. There must be a similar location on other systems.

The web API offers bean inventory as JSON.

It may or may not contain all the info you want on each bean, and it doesn’t return archived beans AFAIK: Scalar API Reference

1 Like

morgan’s API route is the easy half. What it doesn’t give you, as far as I can tell, is per-container on-hand grams or the archived containers.

Both are on disk next to the roast files, in containers/:

  • Windows: %appdata%\roast-time\containers\
  • macOS: ~/Library/Application Support/roast-time/containers/

One JSON file per container: name, startOnHand (grams), beanId, containerGroup (active = current stock), deleted.

The catch: startOnHand may be a running balance rather than the opening weight. I haven’t confirmed which. Check one container against what the app shows before you trust it for cost.

beanId joins to beans/ for name, country and process; the bean file has no weight of its own, so the join is what makes a usable row:

for fn in os.listdir(root + "/containers"):
    c = json.load(open(root + "/containers/" + fn))
    b = beans.get(c.get("beanId"), {})
    print(b.get("name"), c.get("startOnHand"))

That’s one row per container, archived ones included.