Title here
Summary here
These snippets match the Pionia Shop tutorial. Copy them as starting points for the store API on port 8000.
Build the services behind these curls.
How service and action map to HTTP.
| Example | Action | Learn more |
|---|---|---|
| Ping | Health check | Introduction |
| List products | product.list | Tutorial |
| Create product | product.create | Validation |
| Customer login | customer.login | JWT |
| Place order | order.place | Protecting actions |
curl -s http://127.0.0.1:8000/api/v1/pingcurl -s -X POST http://127.0.0.1:8000/api/v1/ \
-H "Content-Type: application/json" \
-d '{"service":"product","action":"list"}'{
"returnCode": 0,
"returnMessage": "OK",
"returnData": {
"products": [
{ "id": 1, "name": "Ada Mug", "price": 24.5, "stock": 12 }
]
}
}curl -s -X POST http://127.0.0.1:8000/api/v1/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"service":"product","action":"create","name":"Tote Bag","price":18,"stock":40}'curl -s -X POST http://127.0.0.1:8000/api/v1/ \
-H "Content-Type: application/json" \
-d '{"service":"customer","action":"login","email":"ada@pionia.shop","password":"secret"}'{
"returnCode": 0,
"returnMessage": "Logged in",
"returnData": { "token": "eyJhbGciOiJIUzI1NiJ9..." }
}curl -s -X POST http://127.0.0.1:8000/api/v1/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"service":"order","action":"place","product_id":1,"quantity":2}'curl -s -X POST http://127.0.0.1:8000/api/v1/ \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"service":"wallet","action":"balance"}'