API Reference: Retention
Endpoint untuk membaca dan mengubah kebijakan retensi, menjalankan cleanup, dan memantau pemakaian disk.
← Kembali ke Retention
Tiga pass cleanup, pengaman darurat, dan tips.
Recordings
Endpoint rekaman yang dikelola retensi.
Liodra tidak memiliki otentikasi API sendiri; batasi akses port 9080 di tingkat jaringan atau reverse proxy. Basis URL memakai variabel LIODRA_API_URL (default http://localhost:9080). Endpoint di halaman ini hanya terdaftar bila playback aktif (--as-nvr) dan retentions.yaml ada; jika tidak menjawab 404. Semua jam dalam UTC.
Konfigurasi
Konfigurasi Retensi
Response Body
application/json
application/json
curl -X GET "http://localhost:9080/api/v1/retention"{ "success": true, "data": { "time": "02:00:00", "max_disk_usage_percent": 80, "max_recommended_quota_mb": 838860, "default_retention": { "duration_days": 7, "disk_quota_mb": 0 }, "channel_policies": [ { "channel": "live/security", "retention": { "duration_days": 90, "disk_quota_mb": 5242880, "headroom_percent": 10 } } ] }}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Perbarui Jadwal Cleanup
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X PUT "http://localhost:9080/api/v1/retention/schedule" \ -H "Content-Type: application/json" \ -d '{ "time": "23:00:00", "default_retention": { "duration_days": 14, "disk_quota_mb": 0 }, "channel_policies": [] }'{ "success": true, "data": { "message": "Cleanup schedule updated successfully", "data": { "time": "23:00:00", "default_retention": { "duration_days": 14, "disk_quota_mb": 0 }, "channel_policies": [] } }}{ "success": false, "error": "Not found", "details": "Resource does not exist"}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Perbarui Retensi Default
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X PUT "http://localhost:9080/api/v1/retention/default" \ -H "Content-Type: application/json" \ -d '{ "duration_days": 14, "disk_quota_mb": 102400 }'{ "success": true, "message": "Operation completed successfully", "data": {}}{ "success": false, "error": "Not found", "details": "Resource does not exist"}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Kebijakan per Channel
Tambah Kebijakan Channel
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "http://localhost:9080/api/v1/retention/policies" \ -H "Content-Type: application/json" \ -d '{ "channel": "live/security", "retention": { "duration_days": 90, "disk_quota_mb": 5242880, "headroom_percent": 10, "time_of_day_start": "00:00:00", "time_of_day_end": "23:59:59" } }'{ "success": true, "message": "Operation completed successfully", "data": {}}{ "success": false, "error": "Not found", "details": "Resource does not exist"}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Perbarui Kebijakan Channel
Path Parameters
Nama channel, boleh bertingkat.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X PUT "http://localhost:9080/api/v1/retention/policies/live/security" \ -H "Content-Type: application/json" \ -d '{ "retention": { "duration_days": 30, "disk_quota_mb": 1048576 } }'{ "success": true, "message": "Operation completed successfully", "data": {}}{ "success": false, "error": "Not found", "details": "Resource does not exist"}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Hapus Kebijakan Channel
curl -X DELETE "http://localhost:9080/api/v1/retention/policies/live/security"{ "success": true, "message": "Channel policy deleted successfully", "data": { "channel": "live/security" }}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Cleanup Manual
Semua Channel
Response Body
application/json
application/json
curl -X POST "http://localhost:9080/api/v1/retention/cleanup"{ "success": true, "message": "Cleanup completed successfully", "data": { "start_time": "2026-09-15T02:00:00Z", "end_time": "2026-09-15T02:02:15Z", "duration": "2m15s", "files_deleted": 1247, "bytes_freed": 5368709120, "channel_stats": [ { "channel": "live", "files_deleted": 1247, "bytes_freed": 5368709120 } ] }}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Satu Channel
curl -X POST "http://localhost:9080/api/v1/retention/cleanup/live"{ "success": true, "message": "string", "data": { "channel": "string", "stats": { "start_time": "2019-08-24T14:15:22Z", "end_time": "2019-08-24T14:15:22Z", "duration": "2m15s", "files_deleted": 1247, "bytes_freed": 5368709120, "channel_stats": [ { "channel": "live", "files_deleted": 523, "bytes_freed": 2147483648 } ], "errors": [ "string" ] } }}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Pemakaian Disk
Sistem
Response Body
application/json
application/json
curl -X GET "http://localhost:9080/api/v1/retention/usage"{ "success": true, "data": { "disk_usage": { "total_mb": 1048576, "used_mb": 524288, "available_mb": 524288, "used_percent": 50 }, "disk_io": { "read_kbps": 1200.5, "write_kbps": 8450.2, "busy_percent": 12.3, "sample_time_ms": 1000 }, "recording_dir": "/usr/share/nginx/html/storage/recordings", "timestamp": "2026-09-15T10:30:00Z" }}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Per Channel
curl -X GET "http://localhost:9080/api/v1/retention/usage/live/security"{ "success": true, "data": { "channel": "live/security", "usage_mb": 421888, "usage_gb": 412, "timestamp": "2026-09-15T10:30:00Z" }}{ "success": false, "error": "Not found", "details": "Resource does not exist"}Retention
Menghapus rekaman secara otomatis berdasarkan umur, jendela jam, dan kuota disk per channel, dengan pengaman darurat saat disk hampir penuh.
VoD (Video Upload)
Mengunggah file video per chunk dengan resume, menyimpannya dengan waktu rekam nyata, memutarnya ulang sebagai stream, dan mengaksesnya lewat playback berbasis waktu.