🔗 Documentation API
API publique Boaz-Housing pour développeurs externes
📋 Fichiers Disponibles
Guide complet d'utilisation de l'API externe
- Authentification
- Endpoints disponibles
- Exemples requêtes
- Codes erreurs
API Logements spécifique
- CRUD logements
- Filtres avancés
- Vérification disponibilité
Kit développeur complet avec exemples
- Scripts Python/JavaScript
- Collections Postman
- Tests automatisés
🎯 API Base URL
Production : https://api-housing.boaz-study.tech
Développement : http://localhost:8001
🚀 Quick Start
1. Authentification
| # Login
curl -X POST https://api-housing.boaz-study.tech/api/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"user@example.com","password":"password"}'
# Réponse
{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGc...",
"token_type": "bearer",
"user": {...}
}
|
2. Utiliser l'API
| # Exemple : Lister logements disponibles
curl -X GET https://api-housing.boaz-study.tech/api/logements/disponibles \
-H "Authorization: Bearer YOUR_TOKEN"
|
3. Créer une ressource
| # Exemple : Créer un logement
curl -X POST https://api-housing.boaz-study.tech/api/logements/ \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"titre": "Studio moderne",
"adresse": "10 rue Example",
"ville": "Paris",
"loyer": 600.00,
"montant_charges": 50.00
}'
|
📊 Endpoints Principaux
Logements
| GET /api/logements/ - Liste logements
GET /api/logements/disponibles - Logements disponibles
POST /api/logements/ - Créer logement
GET /api/logements/{id} - Détail logement
PUT /api/logements/{id} - Modifier logement
DELETE /api/logements/{id} - Supprimer logement
|
Souscriptions
| GET /api/souscriptions/ - Liste souscriptions
POST /api/souscriptions/ - Créer souscription
GET /api/souscriptions/{id} - Détail souscription
PUT /api/souscriptions/{id} - Modifier souscription
POST /api/souscriptions/{id}/paiement-en-ligne - Paiement Stripe
|
Services
| GET /api/services/ - Liste services disponibles
|
Organisation
| GET /api/organisation/ - Détails organisation
|
🔑 Authentification
Type : Bearer Token (JWT)
Header requis :
| Authorization: Bearer YOUR_JWT_TOKEN
|
Obtention token :
| POST /api/auth/login
Body: {"email": "...", "password": "..."}
|
Succès
| {
"id": 123,
"titre": "Studio moderne",
"ville": "Paris",
...
}
|
Liste
| [
{"id": 1, ...},
{"id": 2, ...}
]
|
Erreur
| {
"detail": "Logement non trouvé"
}
|
🐛 Codes Erreurs
| Code |
Signification |
Action |
| 200 |
OK |
Succès |
| 201 |
Created |
Ressource créée |
| 400 |
Bad Request |
Vérifier données envoyées |
| 401 |
Unauthorized |
Token manquant/invalide |
| 403 |
Forbidden |
Droits insuffisants |
| 404 |
Not Found |
Ressource introuvable |
| 422 |
Unprocessable Entity |
Validation échouée |
| 500 |
Internal Server Error |
Erreur serveur |
🔗 Liens Utiles
🧪 Tests
Collection Postman
Voir kit-developpeur.md pour télécharger la collection
Tests automatisés
| # Backend
cd backend
pytest
# Avec coverage
pytest --cov=app tests/
|
Maintenu par : Équipe Boaz-Housing Dev
Dernière mise à jour : 01/10/2025