51 lines
1.7 KiB
Markdown
51 lines
1.7 KiB
Markdown
# Testing
|
|
|
|
[← Zurück: Sicherheitshinweise](10-security.md) | [Weiter: Troubleshooting →](12-troubleshooting.md)
|
|
|
|
## Manuelle API-Tests mit curl:
|
|
|
|
```bash
|
|
# 1. Login (erhalten Sie Token)
|
|
curl -X POST "http://localhost:8000/api/local/auth/login" \
|
|
-H "Content-Type: application/x-www-form-urlencoded" \
|
|
-d "username=youruser&password=yourpass"
|
|
|
|
# 2. Session erstellen
|
|
curl -X POST "http://localhost:8000/api/realestate/sessions" \
|
|
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"title": "Parzellen-Analyse Zürich"}'
|
|
|
|
# 3. Query ausführen - Beispiel: Alle Parzellen in Zürich
|
|
curl -X POST "http://localhost:8000/api/realestate/sessions/SESSION_ID/queries" \
|
|
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"queryText": "SELECT label, plz, bauzone, az, bz, gebaeudehoeheMax FROM Parzelle WHERE plz = ''8000'' ORDER BY label LIMIT 20",
|
|
"queryType": "sql"
|
|
}'
|
|
|
|
# 4. Query ausführen - Beispiel: Projekte mit Status "Planung"
|
|
curl -X POST "http://localhost:8000/api/realestate/sessions/SESSION_ID/queries" \
|
|
-H "Authorization: Bearer YOUR_TOKEN" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{
|
|
"queryText": "SELECT id, label, \"statusProzess\" FROM Projekt WHERE \"statusProzess\" = ''Planung''",
|
|
"queryType": "sql"
|
|
}'
|
|
|
|
# 5. Queries abrufen
|
|
curl -X GET "http://localhost:8000/api/realestate/sessions/SESSION_ID/queries" \
|
|
-H "Authorization: Bearer YOUR_TOKEN"
|
|
```
|
|
|
|
## Swagger UI:
|
|
|
|
Nach dem Start der Anwendung können Sie die API unter `http://localhost:8000/docs` testen.
|
|
|
|
---
|
|
|
|
[← Zurück: Sicherheitshinweise](10-security.md) | [Weiter: Troubleshooting →](12-troubleshooting.md)
|
|
|
|
|
|
|