Scan Controller Documentation
The ScanController
handles media library scanning
operations, including starting a new scan and checking the progress of
an ongoing scan.
Controller Route: /api/scan
All routes within the ScanController
are prefixed by
/api/scan
.
Summary of Endpoints
Endpoint | Method | Description | Authorization |
---|---|---|---|
/api/scan/start |
POST | Initiates a media library scan. | Admin |
/api/scan/progress |
GET | Retrieves the current scan progress. | Admin |
Start a Media Library Scan
Initiates a new scan of the media library.
Details:
- Endpoint:
/api/scan/start
- Method:
POST
- Authorization: JWT (Roles: Admin)
Parameters:
-
skip (boolean, optional): If set to
true
, skips files that haven't been modified since last scan. (default:false
).
Responses:
- 202 Accepted: The scanner has started successfully.
- 425 Too Early: The scanner is already running.
Example Request (using curl
):
curl -X POST "https://your-api-url.com/api/scan/start?skip=false" \
-H "Authorization: Bearer <JWT-token>"
Get Scan Progress
Fetches the current progress of an ongoing scan, including the number of scanned and found files. If you want Realtime progress updates, use the client WebSocket SEND PROGRESS command.
Details:
- Endpoint:
/api/scan/progress
- Method:
GET
- Authorization: JWT (Roles: Admin)
Responses:
- 200 OK: Returns the current scan progress.
- 204 No Content: No scan is currently running.
Example Request (using curl
):
curl -X GET "https://your-api-url.com/api/scan/progress" \
-H "Authorization: Bearer <JWT-token>"