Getting Started
Last updated
Was this helpful?
Was this helpful?
import uuid
session_id = str(uuid.uuid4())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())
}
# Acquire a tomato
response = requests.post(f"{API_BASE}/tomato/acquire", headers=HEADERS, json={
"variety": "San Marzano",
"ripeness": 0.8,
"weight": 150
})
print(response.status_code) # 200
print(response.json()) # {"id": "tom_abc123", "variety": "San Marzano", ...}curl -X POST https://api.tomatopy.pizza/v1/tomato/acquire \
-H "Content-Type: application/json" \
-H "X-API-Key: your-api-key" \
-H "X-Session-ID: your-session-id" \
-d '{"variety": "San Marzano", "ripeness": 0.8, "weight": 150}'response = requests.post(f"{API_BASE}/tomato/acquire", headers=HEADERS, json={
"variety": "Roma",
"ripeness": 0.7,
"weight": 100
})
if response.status_code == 200:
print("API key is valid!")
else:
print(f"Error: {response.status_code} - {response.json()}")