Skip to content

ee-api — the shared ERP/storefront client

Created 2026-09-24. Repo ~/ee-api, venv ~/.local/share/ee-api-venv.

What it is

A thin layer over inventree-python, the official maintained client — deliberately not a sixth hand-rolled HTTP client. erp-part, erp-bom-export and kicad-erp-sync each reimplement auth, pagination and error handling in urllib; this is meant to replace that.

It adds only what a general library cannot know: our conventions, and the InvenTree behaviours whose error messages point somewhere other than the cause.

Trap How it presents
A sub-part must be component before joining a BOM Invalid pk 181 - object does not exist for a part that exists
sale_price_min is the cheapest break, not a line price A single unit invoices at the 5+ price, silently
salable ≠ "sell it on the web" Distributor-only products look like storefront gaps
Metadata is unwritable over plain token HTTP 403 CSRF blaming correct settings; a part PATCH returns 200 and discards it
The ERP reached is whatever the env last pointed at A sandbox caller silently reading production
api.get() does not prepend /api Response content-type is not JSON against an HTML 404

21 tests, no network, each a named incident rather than a hypothetical.

Two corrections it produced

Part metadata IS writable — through inventree-python, not over raw token HTTP. Earlier today this was recorded as "cannot be written by any script", which was wrong. So the storefront flag belongs on the ERP part after all, and was set there for all five salable parts: EE-C-0184 and EE-C-0197 true, the three cow kits false. ~/embeddedera-store/config/storefront-channels.json can retire once mapping-register.py reads the ERP instead.

inventree-python's api.get() takes an absolute path including /api.

Open

  • Move the WooCommerce side here: the docker exec … mariadb catalog read and the wp eval writer, both currently repeated in ~/embeddedera-store/scripts/.
  • Distributor SKUs. part-lookup returns MPN, price, stock and lifecycle but not the Digi-Key or Mouser part number, and SOP-002 requires a SKU on a supplier part — so supplier parts still cannot be created without a browser. This blocks finishing any BOM.
  • Point mapping-register.py at the ERP storefront flag and retire the JSON file.
  • Migrate erp-part, erp-bom-export and kicad-erp-sync off their own urllib.

Log

  • 2026-09-24 — Created (88b23b5). Built on the official client after confirming it handles pagination, the object model and metadata writes.