← All work

Beverage co-packing & manufacturing

Self-service customer API into NetSuite

A secure, multi-tenant API that lets a co-packing customer read its inventory, lots and orders, and create orders, in Sojo's NetSuite without being given a NetSuite login.

  1. Customer app
  2. Bearer-token API
  3. OAuth 2.0 M2M
  4. NetSuite RESTlet
Client
Sojo Industries ↗
Beverage co-packing & manufacturing
Stack
Python FastAPI, NetSuite OAuth 2.0 M2M, SuiteScript 2.1, SuiteQL, SuiteCloud SDF, Railway

Results

  • Live in production for DRINK LMNT
  • Designed to onboard more customers without code changes

The problem

DRINK LMNT wanted self-service access to its items, inventory, lot and expiry detail, and order status, plus the ability to submit orders. Giving a customer direct access to the ERP was not an option.

What I built

  • A multi-tenant API proxy:
    • Per-customer bearer tokens, compared in constant time.
    • An allow-list of permitted actions.
    • Writes blocked over GET.
  • NetSuite machine-to-machine auth (OAuth 2.0 with ES256 JWT), with the token cached.
  • A RESTlet with 11 actions, such as items, inventory balance, fulfillments with lot/expiry, and create/update of inbound and outbound orders keyed on external ID.
  • Separate staging and production. The RESTlet is deployed through SDF to three NetSuite accounts.