Perfect Pizza Production
This tutorial walks you through the complete PizzaStack pipeline: from acquiring tomatoes to baking and tasting a finished pizza. By the end, you will have a full working Python script.
Prerequisites
Before starting, make sure you have:
A PizzaStack API key (sign up at tomatopy.pizza)
Python with the
requestslibrary installed (pip install requests)Understanding of the basic concepts
Setup
import requests
import uuid
API_BASE = "https://api.tomatopy.pizza/v1"
HEADERS = {
"Content-Type": "application/json",
"X-API-Key": "your-api-key",
"X-Session-ID": str(uuid.uuid4())
}
def api_post(endpoint, payload):
"""Helper to make API calls and check for errors."""
response = requests.post(f"{API_BASE}{endpoint}", headers=HEADERS, json=payload)
response.raise_for_status()
return response.json()Step 1: Acquire Tomatoes
Step 2: Slice the Tomatoes
Slicing is essential. Raw tomato IDs passed directly to /cook/simmer will silently produce low-quality sauce.
Step 3: Simmer Into Sauce
Step 4: Create the Pizza Base
Step 5: Assemble the Pizza
Assembly is required before baking. The /pizza/bake endpoint only accepts pizza_id values from /pizza/assemble -- passing a base_id directly will return a 400 error.
Step 6: Bake the Pizza
Step 7: Taste Test
Complete Working Script
Troubleshooting
Common Issues
Low Quality Score
Check that you sliced tomatoes before simmering. Raw tomato IDs silently degrade sauce quality, which cascades to the final pizza score.
400 Error on /pizza/bake
You must call
/pizza/assemblefirst. The bake endpoint requires apizza_idfrom assembly, not abase_id.Objects Not Found
Make sure all requests use the same
X-Session-ID. Objects from one session cannot be referenced in another.
Best Practices
Always Follow the Pipeline Order
acquire -> slice -> simmer -> base -> assemble -> bake
Check Quality at Each Step
Use a Helper Function
The
api_posthelper shown above reduces boilerplate and ensures errors are caught early.
Next Steps
Advanced Flavor Profiling - Deep dive into taste analysis
API Usage Best Practices - Optimize your API usage
Session Management - Manage sessions effectively
Last updated
Was this helpful?