# ============================================================ # USERS # ⚠ Les IDs sont en mémoire vive : ils repartent à 1 après # chaque redémarrage des conteneurs. Exécuter dans l'ordre # depuis un démarrage propre (docker compose up). # ============================================================ ### 1. Créer l'utilisateur Alice → reçoit id=1 # @name createAlice POST http://localhost:8000/users Content-Type: application/json {"name": "Alice", "email": "alice@example.com"} ### ### 2. Créer l'utilisateur Bob → reçoit id=2 # @name createBob POST http://localhost:8000/users Content-Type: application/json {"name": "Bob", "email": "bob@example.com"} ### ### 3. Récupérer Alice (id=1) GET http://localhost:8000/users/1 ### ### 4. Récupérer Bob (id=2) GET http://localhost:8000/users/2 ### ### Récupérer un utilisateur inexistant → 404 GET http://localhost:8000/users/99 ### # ============================================================ # PRODUCTS # ============================================================ ### Consulter le Laptop (id=1, stock initial=10) GET http://localhost:8000/products/1 ### ### Consulter le Smartphone (id=2, stock initial=20) GET http://localhost:8000/products/2 ### ### Consulter les Headphones (id=3, stock initial=15) GET http://localhost:8000/products/3 ### ### Soustraire 3 Laptops du stock PUT http://localhost:8000/products/1/stock Content-Type: application/json {"quantity": 3} ### ### Vérifier le stock du Laptop après soustraction (attendu: 7) GET http://localhost:8000/products/1 ### ### Soustraire plus que le stock disponible → 400 Insufficient stock PUT http://localhost:8000/products/1/stock Content-Type: application/json {"quantity": 999} ### ### Consulter un produit inexistant → 404 GET http://localhost:8000/products/99 ### # ============================================================ # ORDERS # ============================================================ ### Créer une commande: Alice achète 2 Smartphones POST http://localhost:8000/orders Content-Type: application/json {"user_id": 1, "product_id": 2, "quantity": 2} ### ### Vérifier le stock du Smartphone après commande (attendu: 18) GET http://localhost:8000/products/2 ### ### Récupérer la commande (id=1) GET http://localhost:8000/orders/1 ### ### Créer une commande: Bob achète 1 Laptop POST http://localhost:8000/orders Content-Type: application/json {"user_id": 2, "product_id": 1, "quantity": 1} ### ### Récupérer la commande de Bob (id=2) GET http://localhost:8000/orders/2 ### ### Commande avec utilisateur inexistant → 404 POST http://localhost:8000/orders Content-Type: application/json {"user_id": 99, "product_id": 1, "quantity": 1} ### ### Commande avec produit inexistant → 404 POST http://localhost:8000/orders Content-Type: application/json {"user_id": 1, "product_id": 99, "quantity": 1} ### ### Récupérer une commande inexistante → 404 GET http://localhost:8000/orders/99 ### # ============================================================ # HEALTH CHECKS # ============================================================ ### Health check api-gateway GET http://localhost:8000/health ###