Rapor Oluştur
Yeni rapor oluşturur.
Endpoint
POST /api/v1/reports
Authentication
Bu endpoint authentication gerektirir.
Header: Authorization: Bearer \{token\}
Permission
reports.generate- Tüm raporları oluşturmareports.generate.own- Sadece kendi raporunu oluşturma
Request
Headers
| Header | Değer | Zorunlu |
|---|---|---|
Authorization | Bearer \{token\} | Evet |
Content-Type | application/json | Evet |
Request Body
| Parametre | Tip | Zorunlu | Açıklama |
|---|---|---|---|
title | string | Evet | Rapor başlığı |
report_type | string | Evet | Rapor tipi |
parameters | object | Hayır | Rapor parametreleri (JSON) |
format | string | Hayır | Rapor formatı (pdf, excel, csv, json) |
status | string | Hayır | Rapor durumu (pending, processing, completed, failed) |
is_active | boolean | Hayır | Aktif durumu (varsayılan: true) |
Example Request
{
"title": "Kullanıcı Raporu",
"report_type": "users",
"parameters": {
"date_from": "2025-01-01",
"date_to": "2025-12-31",
"status": "active"
},
"format": "pdf",
"status": "pending"
}
Response
Success Response (201 Created)
{
"id": 1,
"uuid": "550e8400-e29b-41d4-a716-446655440000",
"title": "Kullanıcı Raporu",
"report_type": "users",
"parameters": {
"date_from": "2025-01-01",
"date_to": "2025-12-31",
"status": "active"
},
"format": "pdf",
"status": "pending",
"is_active": true,
"user_id": 1,
"created_at": "2025-11-20T12:00:00.000000Z",
"updated_at": "2025-11-20T12:00:00.000000Z"
}
Error Responses
403 Forbidden
{
"message": "Forbidden"
}
422 Unprocessable Entity
{
"message": "Validation failed",
"errors": {
"title": ["The title field is required."],
"report_type": ["The report type field is required."]
}
}
Code Examples
cURL
curl -X POST https://api.example.com/api/v1/reports \
-H "Authorization: Bearer \{token\}" \
-H "Content-Type: application/json" \
-d '{
"title": "Kullanıcı Raporu",
"report_type": "users",
"parameters": {
"date_from": "2025-01-01",
"date_to": "2025-12-31"
},
"format": "pdf"
}'
Notes
.ownpermission'ı olan kullanıcılar içinuser_idotomatik olarak atanıris_activedeğeri belirtilmemişse varsayılan olaraktruekullanılırstatusdeğeri belirtilmemişse varsayılan olarak "pending" kullanılır- Rapor oluşturulduktan sonra arka planda işlenir
Related Endpoints
- Rapor Listesi - Tüm raporları listele
- Rapor Detayı - Rapor detayını getir