Semaine 11

This commit is contained in:
gauvainboiche
2026-07-11 21:38:00 +02:00
parent d3d2416dea
commit 0d071d2843
281 changed files with 54412 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -e
BASE="http://127.0.0.1:5000/api/equipments"
echo "=== GET liste ==="
curl -sf "$BASE" | python -m json.tool
echo "=== POST création ==="
NEW=$(curl -sf -X POST "$BASE" \
-H "Content-Type: application/json" \
-d '{"hostname":"bash-test","type":"switch","ip_address":"10.0.60.1","is_active":true}')
echo "$NEW" | python -m json.tool
ID=$(echo "$NEW" | python -c "import json,sys; print(json.load(sys.stdin)['id'])")
echo "=== GET #$ID ==="
curl -sf "$BASE/$ID" | python -m json.tool
echo "=== PATCH toggle #$ID ==="
curl -sf -X PATCH "$BASE/$ID/toggle" | python -m json.tool
echo "=== DELETE #$ID ==="
curl -sf -X DELETE "$BASE/$ID" -w "HTTP %{http_code}\n"