Skip to content

Latest commit

 

History

History
87 lines (64 loc) · 1.83 KB

File metadata and controls

87 lines (64 loc) · 1.83 KB

Productory E-commerce

API Examples

Start demo

make install-dev
make demo-run
make loaddata

Create a superuser for staff-only endpoints:

make superuser

Default base URL:

export BASE_URL=http://127.0.0.1:8010

Create category

curl -X POST "$BASE_URL/api/catalog/categories/" \
  -H "Content-Type: application/json" \
  -d '{"name":"Coffee","slug":"coffee","description":"Beans"}'

Create product

curl -X POST "$BASE_URL/api/catalog/products/" \
  -H "Content-Type: application/json" \
  -d '{"name":"Single Origin","slug":"single-origin","sku":"COF-001","category_id":1,"price_amount":"12.50","currency":"ZAR","is_active":true}'

Create cart + add item

curl -X POST "$BASE_URL/api/checkout/carts/" \
  -H "Content-Type: application/json" \
  -d '{"email":"buyer@example.com"}'

curl -X POST "$BASE_URL/api/checkout/cart-items/" \
  -H "Content-Type: application/json" \
  -d '{"cart_id":1,"product_id":1,"quantity":2}'

Checkout cart

curl -X POST "$BASE_URL/api/checkout/checkout/" \
  -H "Content-Type: application/json" \
  -d '{"cart_id":1,"email":"buyer@example.com","full_name":"Buyer"}'

Response includes both VAT-inclusive and VAT-exclusive totals:

  • subtotal_excl_vat_amount
  • subtotal_incl_vat_amount
  • total_excl_vat_amount
  • total_incl_vat_amount
  • tax_amount

Transition order status

curl -X POST "$BASE_URL/api/checkout/orders/1/transition/" \
  -H "Content-Type: application/json" \
  -d '{"status":"paid"}'

Inspect URLs quickly

make show-urls

Internal dashboard KPIs (staff only)

curl -X GET "$BASE_URL/api/internal/dashboard/kpis/?date_from=2026-02-01&date_to=2026-02-18" \
  -u <your-superuser-username>:<your-superuser-password>