API Referansı
RavenON REST API'si, yangın güvenlik sistemlerimize programatik erişim sağlar.
Base URL
https://api.ravenon.com/v1
Kimlik Doğrulama
Tüm API istekleri Bearer token ile kimlik doğrulaması gerektirir:
Authorization: Bearer YOUR_API_KEY
API Anahtarı Alma
POST /auth/register
Content-Type: application/json
{
"email": "user@example.com",
"company": "Şirket Adı"
}
Yanıt:
{
"api_key": "rvn_1234567890abcdef",
"expires_at": "2026-01-31T00:00:00Z"
}
Endpoints
Sistem Durumu
Sistem sağlık durumunu kontrol edin.
GET /status
Yanıt:
{
"status": "operational",
"version": "1.0.0",
"uptime": 99.99,
"timestamp": "2025-01-31T12:00:00Z"
}
Görüntü Analizi
Tek bir görüntüyü yangın tespiti için analiz edin.
POST /analyze
Content-Type: application/json
{
"image": "base64_encoded_image_data",
"detection_type": "fire",
"confidence_threshold": 0.8,
"return_visualization": true
}
Parametreler:
| Parametre | Tip | Zorunlu | Açıklama |
|-----------|-----|---------|----------|
| image | string | Evet | Base64 encoded görüntü |
| detection_type | string | Hayır | "fire", "smoke", "both" (varsayılan: "both") |
| confidence_threshold | float | Hayır | 0.0-1.0 arası (varsayılan: 0.8) |
| return_visualization | boolean | Hayır | Görselleştirme döndür (varsayılan: false) |
Yanıt:
{
"request_id": "req_abc123",
"fire_detected": true,
"smoke_detected": true,
"confidence": 0.95,
"detections": [
{
"type": "fire",
"confidence": 0.95,
"bounding_box": {
"x": 100,
"y": 150,
"width": 200,
"height": 180
}
}
],
"visualization_url": "https://cdn.ravenon.com/viz/abc123.jpg",
"timestamp": "2025-01-31T12:00:00Z"
}
Toplu Analiz
Birden fazla görüntüyü aynı anda analiz edin.
POST /analyze/batch
Content-Type: application/json
{
"images": [
{
"id": "img_001",
"data": "base64_encoded_image_data"
},
{
"id": "img_002",
"data": "base64_encoded_image_data"
}
],
"detection_type": "fire",
"confidence_threshold": 0.8
}
Yanıt:
{
"batch_id": "batch_xyz789",
"total_images": 2,
"results": [
{
"image_id": "img_001",
"fire_detected": true,
"confidence": 0.92
},
{
"image_id": "img_002",
"fire_detected": false,
"confidence": 0.15
}
]
}
Video Analizi
Video dosyasını analiz edin.
POST /analyze/video
Content-Type: multipart/form-data
video: <video_file>
detection_type: fire
frame_interval: 30
Parametreler:
| Parametre | Tip | Zorunlu | Açıklama |
|-----------|-----|---------|----------|
| video | file | Evet | Video dosyası (max 100MB) |
| detection_type | string | Hayır | "fire", "smoke", "both" |
| frame_interval | integer | Hayır | Kaç frame'de bir analiz (varsayılan: 30) |
Yanıt:
{
"video_id": "vid_123",
"status": "processing",
"estimated_time": 120,
"webhook_url": "https://your-domain.com/webhook"
}
Webhook Yönetimi
Webhook'ları yönetin.
Webhook Oluştur
POST /webhooks
Content-Type: application/json
{
"url": "https://your-domain.com/webhook",
"events": ["fire_detected", "smoke_detected"],
"secret": "your_webhook_secret"
}
Webhook Listele
GET /webhooks
Webhook Sil
DELETE /webhooks/{webhook_id}
Kamera Yönetimi
Kameraları yönetin ve izleyin.
Kamera Ekle
POST /cameras
Content-Type: application/json
{
"name": "Giriş Kapısı",
"stream_url": "rtsp://camera-ip:554/stream",
"location": {
"building": "A Blok",
"floor": 1,
"coordinates": {
"lat": 40.9925,
"lng": 29.1244
}
},
"monitoring_enabled": true
}
Kamera Listele
GET /cameras
Kamera Durumu
GET /cameras/{camera_id}/status
Yanıt:
{
"camera_id": "cam_123",
"name": "Giriş Kapısı",
"status": "online",
"last_detection": "2025-01-31T11:45:00Z",
"total_detections": 5,
"monitoring_enabled": true
}
Hata Kodları
| Kod | Açıklama | |-----|----------| | 200 | Başarılı | | 400 | Geçersiz istek | | 401 | Kimlik doğrulama hatası | | 403 | Yetki hatası | | 404 | Kaynak bulunamadı | | 429 | Rate limit aşıldı | | 500 | Sunucu hatası |
Hata Yanıtı Formatı
{
"error": {
"code": "invalid_request",
"message": "Geçersiz görüntü formatı",
"details": {
"field": "image",
"reason": "Base64 decode hatası"
}
}
}
Rate Limiting
Rate limit bilgileri yanıt header'larında döner:
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 45
X-RateLimit-Reset: 1706702400
Webhook Payload
Yangın tespit edildiğinde webhook'unuza gönderilen payload:
{
"event": "fire_detected",
"timestamp": "2025-01-31T12:00:00Z",
"data": {
"detection_id": "det_abc123",
"camera_id": "cam_123",
"camera_name": "Giriş Kapısı",
"location": {
"building": "A Blok",
"floor": 1
},
"confidence": 0.95,
"image_url": "https://cdn.ravenon.com/detections/abc123.jpg",
"severity": "high"
}
}
SDK'lar
Resmi SDK'larımız:
- Python:
pip install ravenon-sdk - JavaScript:
npm install @ravenon/sdk - Go:
go get github.com/ravenon/sdk-go
Python SDK Örneği
from ravenon import RavenON
client = RavenON(api_key="your_api_key")
# Görüntü analizi
result = client.analyze_image("path/to/image.jpg")
print(result.fire_detected)
# Kamera izleme
camera = client.add_camera(
name="Giriş Kapısı",
stream_url="rtsp://camera-ip:554/stream"
)
camera.start_monitoring()
Destek
API ile ilgili sorularınız için:
- 📧 api-support@ravenon.com
- 📚 API Changelog
- 🐛 Issue Tracker