Smile Python 繁中
← Back to technical work

01 / REST API

Technical demo · Synthetic data

Store Inventory and Orders API

A read-only Python API prototype that lets another system look up product inventory or order status by ID. It validates input and documents response fields with OpenAPI. It does not write data.

One product lookup, request to responseLive site demo · Synthetic data

01 / Request

GET /api/lab/products/P-1001

The site demo is read-only. Its URLs differ from those in the Python repository.

02 / Response 200 OK

{
  "data": {
    "id": "P-1001",
    "label": "晨光手帳",
    "category": "文具",
    "price": {"amount": 420, "currency": "TWD"},
    "available": true
  },
  "meta": {"synthetic": true}
}

The product is in data; meta.synthetic identifies sample data. The product label and category are returned in Traditional Chinese.

Try the API and inspect the contract

The repository includes an OpenAPI contract. These examples are for a test instance you run yourself and require that instance’s test bearer token:

GET /api/products/P001/inventory
GET /api/orders/O004/status
Authorization: Bearer <YOUR_TEST_TOKEN>

The inventory response contains the product ID, name, stock and availability. The order response contains the order ID, status and update time.

How to verify the interface

  • Look up an existing ID and check the response against the documented fields.
  • Compare a missing ID (404) with an invalid ID format (400).
  • Confirm the endpoint is read-only and uses synthetic product and order data.

The demo is not connected to a shop or customer system.