Files
bookhoard/docs/developer/api/system/settings.md
T
john-okeefe 4d321528b2 docs: update comprehensive API documentation and project guides
This commit updates all documentation files throughout the project:

- Updated IMPLEMENTATION_PLAN.md with new implementation details
- Updated PROJECT_GUIDELINES.md with coding standards and practices
- Updated README.md with current project information
- Updated SCREENSHOT_AUTOMATION.md with new automation details
- Added TEST_DATA.md with test fixtures data
- Updated cover_image_serving_plan.md with static URL patterns

Documentation API updates:
- Updated API reference documentation for all endpoints including:
  - Authentication (login, logout, register, refresh_token)
  - Book matching (auto_link, bulk_link, link_book, search)
  - Collections (CRUD operations, shelf mappings, auto-assign rules)
  - Conflicts (bulk operations, resolve/dismiss)
  - Devices (registration, approval, shelf management)
  - Highlights (create, update, delete, get)
  - Kobo sync (bookmark, markup, initialization, sync)
  - KOReader sync (library, metadata, bookmarks, progress)
  - Libraries (CRUD, folders, media items, stats)
  - Media items (bulk operations, CRUD)
  - Notes (CRUD operations)
  - OPDS (acquisition, feeds, publication)
  - Progress (reading progress tracking)
  - Queue (device queue management)
  - Ratings (star ratings)
  - Scanner (watch mode, scan operations)
  - Sync protocols (Kobo, KOReader)
  - Users (profile, password, admin operations)
  - WebSocket protocols

- Updated user guides (admin, dashboard, settings, sync)
- Updated device setup guides (Kobo, KOReader)
- Updated developer guides (testing, contributing, operations)
- Updated scripts/README.md
2026-02-27 17:06:22 -05:00

4.7 KiB

System Scan Settings API

Overview

The System Scan Settings API allows administrators to configure system-wide scan settings that apply to all libraries. These settings control the automatic scanning behavior for the entire Bookhoard system.

Base URL: /api/libraries Authentication: Admin JWT token required Content-Type: application/json


Endpoints

Get System Scan Settings

Retrieve the current system-wide scan settings.

Endpoint: GET /api/libraries/scan-settings

Authentication: Admin role required

Response:

  • 200 OK: Returns current scan settings
  • 401 Unauthorized: Invalid or missing authentication
  • 403 Forbidden: User does not have admin role
  • 500 Internal Server Error: Server error

Response Body:

{
  "scan_frequency_minutes": 60,
  "auto_scan_enabled": true
}

Fields:

  • scan_frequency_minutes (integer): How often to scan all libraries in minutes (15-1440)
  • auto_scan_enabled (boolean): Whether auto-scanning is enabled system-wide

Example:

curl -X GET https://bookhoard.example.com/api/libraries/scan-settings \
  -H "Authorization: Bearer <admin_token>"

Update System Scan Settings

Update the system-wide scan settings.

Endpoint: PUT /api/libraries/scan-settings

Authentication: Admin role required

Request Body:

{
  "scan_frequency_minutes": 30,
  "auto_scan_enabled": true
}

Fields:

  • scan_frequency_minutes (integer, required): How often to scan all libraries in minutes
    • Minimum: 15 (15 minutes)
    • Maximum: 1440 (24 hours)
    • Default: 60
  • auto_scan_enabled (boolean, required): Whether auto-scanning is enabled system-wide
    • Default: true

Response:

  • 200 OK: Settings updated successfully
  • 400 Bad Request: Invalid request parameters
  • 401 Unauthorized: Invalid or missing authentication
  • 403 Forbidden: User does not have admin role
  • 500 Internal Server Error: Server error

Success Response Body:

{
  "scan_frequency_minutes": 30,
  "auto_scan_enabled": true,
  "message": "scan settings updated successfully"
}

Error Response Body:

{
  "error": "error message"
}

Validation Rules:

  • scan_frequency_minutes must be between 15 and 1440 minutes
  • Both fields are required

Example:

curl -X PUT https://bookhoard.example.com/api/libraries/scan-settings \
  -H "Authorization: Bearer <admin_token>" \
  -H "Content-Type: application/json" \
  -d '{
    "scan_frequency_minutes": 30,
    "auto_scan_enabled": true
  }'

Behavior

Scan Frequency

The scan_frequency_minutes setting determines how often the system will automatically scan all libraries for new media files. The scheduler will trigger scans for all libraries at the configured interval.

Constraints:

  • Minimum: 15 minutes (to prevent excessive scanning)
  • Maximum: 1440 minutes (24 hours)
  • Default: 60 minutes (1 hour)

Auto-Scan Toggle

The auto_scan_enabled setting acts as a master switch for automatic scanning:

  • When true: All libraries will be scanned automatically at the configured interval
  • When false: No automatic scans will occur (manual scans still available)

System-Wide Scope

These settings apply to all libraries in the system. Individual users can no longer configure per-user scan settings. This ensures consistent scanning behavior across the entire Bookhoard instance.


Error Codes

Status Code Error Description
400 Invalid request parameters (e.g., frequency outside range)
401 Missing or invalid JWT token
403 User lacks admin role
500 Internal server error (e.g., database connection issue)

  • POST /api/libraries/{id}/scan - Manually trigger a scan for a specific library (admin only)
  • GET /api/libraries - List all libraries
  • GET /api/libraries/{id} - Get details for a specific library

Migration Notes

This API replaces the previous per-user scan settings system. The following changes were made:

  • Removed: Per-user scan settings (previously in users table)
  • Added: System-wide scan settings (now in system_settings table)
  • Changed: Access control from user-specific to admin-only
  • Preserved: Endpoint paths remain the same for backward compatibility

The migration ensures that:

  1. All libraries scan at the same frequency
  2. Only administrators can modify scan settings
  3. The API endpoints remain unchanged for existing clients
  4. The scheduler uses system-wide settings instead of user-specific settings