Updated the Obsidian docs-vault
This commit is contained in:
1 parent
72fd77ee01
commit
260282a0e2
36 files changed
+3497
-144
No files matched your search
@@ -0,0 +1,230 @@
|
||||
---
|
||||
title: API Reference
|
||||
tags:
|
||||
- backend
|
||||
- api
|
||||
- endpoints
|
||||
aliases:
|
||||
- Endpoints
|
||||
- REST API
|
||||
---
|
||||
|
||||
# API Reference
|
||||
|
||||
All endpoints are prefixed with `/api/v1`. See [[Backend]] for server setup.
|
||||
|
||||
---
|
||||
|
||||
## Entries
|
||||
|
||||
> [!info] File: `routes/entry.routes.js` → `controllers/entryController.js`
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/entries` | Get all library entries (with IDs, ratings, genres, networks, media, seens, seasons) |
|
||||
| `GET` | `/entries/:id` | Get entry by ID — triggers [[Services#Lazy Refresh\|lazy refresh]] if stale |
|
||||
| `POST` | `/entries` | Add entry from TMDB: `{ tmdb_id, is_tvserie }` |
|
||||
| `PUT` | `/entries/:id` | Update entry fields: `{ entryData }` |
|
||||
| `PUT` | `/entries/:id/ratings` | Update ratings: `{ entryRatings }` |
|
||||
| `PUT` | `/entries/:id/ids` | Update external IDs |
|
||||
| `DELETE` | `/entries/:id` | Delete entry and all related data |
|
||||
| `GET` | `/entries/:id/seasons` | Get all seasons for a TV entry |
|
||||
| `PUT` | `/entries/:id/refresh` | Force refresh from TMDB |
|
||||
| `PUT` | `/entries/:id/fetch-collection` | Fetch/create TMDB collection for entry |
|
||||
| `GET` | `/entries/sync-series` | Batch refresh all non-ended TV series |
|
||||
| `POST` | `/entries/:id/media` | Upload media (multipart — poster/backdrop/logo) |
|
||||
| `PUT` | `/entries/:entryId/media/:mediaId` | Set media as selected |
|
||||
|
||||
### TMDB Proxy
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/entries/tmdb/trending/:type` | Trending movies/tv |
|
||||
| `GET` | `/entries/tmdb/popular/:type` | Popular movies/tv |
|
||||
| `GET` | `/entries/tmdb/top-rated/:type` | Top-rated movies/tv |
|
||||
| `GET` | `/entries/tmdb/upcoming/movie` | Upcoming movies |
|
||||
| `GET` | `/entries/tmdb/search?query=&page=` | Multi-search |
|
||||
|
||||
---
|
||||
|
||||
## Collections
|
||||
|
||||
> [!info] File: `routes/collection.routes.js` → `controllers/collectionController.js`
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/collections` | All collections |
|
||||
| `GET` | `/collections/:id` | Collection by ID with entries |
|
||||
| `POST` | `/collections` | Create user collection |
|
||||
| `PUT` | `/collections/:id` | Update (multipart — poster/backdrop) |
|
||||
| `PUT` | `/collections/:id/refresh` | Refresh from TMDB |
|
||||
| `PUT` | `/collections/:id/parts` | Fetch missing parts from TMDB |
|
||||
| `DELETE` | `/collections/:id` | Delete collection |
|
||||
| `POST` | `/collections/:collectionId/entries/:entryId` | Add entry to collection |
|
||||
| `PATCH` | `/collections/:collectionId/entries/:entryId` | Update entry order |
|
||||
| `DELETE` | `/collections/:collectionId/entries/:entryId` | Remove entry from collection |
|
||||
| `POST` | `/collections/collection-with-entry` | Create collection + add first entry |
|
||||
|
||||
---
|
||||
|
||||
## Entry Seen (Movie Watch Records)
|
||||
|
||||
> [!info] File: `routes/entry-seen.routes.js` → `controllers/entrySeenController.js`
|
||||
|
||||
See [[Watch Tracking]] for the accuracy system.
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/entry-seen` | All entry seens |
|
||||
| `GET` | `/entry-seen/by-entry/:entryId` | Watch records for an entry |
|
||||
| `GET` | `/entry-seen/:id` | Single record by ID |
|
||||
| `POST` | `/entry-seen` | Create: `{ entry_id, date_seen, seen_with, accuracy }` |
|
||||
| `PUT` | `/entry-seen/:id` | Update record |
|
||||
| `DELETE` | `/entry-seen/:id` | Delete record |
|
||||
|
||||
---
|
||||
|
||||
## Episode Seen (Episode Watch Records)
|
||||
|
||||
> [!info] File: `routes/episode-seen.routes.js` → `controllers/episodeSeenController.js`
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/episode-seen` | All episode seens |
|
||||
| `GET` | `/episode-seen/by-episode/:episodeId` | Watch records for an episode |
|
||||
| `GET` | `/episode-seen/by-entry/:entryId` | All episode seens for an entry |
|
||||
| `GET` | `/episode-seen/:id` | Single record by ID |
|
||||
| `POST` | `/episode-seen` | Create: `{ entry_id, episode_id, date_seen, seen_with, accuracy }` |
|
||||
| `PUT` | `/episode-seen/:id` | Update record |
|
||||
| `DELETE` | `/episode-seen/:id` | Delete record |
|
||||
|
||||
---
|
||||
|
||||
## Seasons
|
||||
|
||||
> [!info] File: `routes/season.routes.js` → `controllers/seasonController.js`
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/seasons` | All seasons |
|
||||
| `GET` | `/seasons/:id` | Season by ID (includes episodes with episodeSeens) |
|
||||
| `GET` | `/seasons/:id/episodes` | Season episodes only |
|
||||
| `POST` | `/seasons` | Create season |
|
||||
| `PUT` | `/seasons/:id` | Update season |
|
||||
| `DELETE` | `/seasons/:id` | Delete season |
|
||||
|
||||
---
|
||||
|
||||
## Episodes
|
||||
|
||||
> [!info] File: `routes/episode.routes.js` → `controllers/episodeController.js`
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/episodes/month/:startDate/:endDate` | Episodes airing between dates (for [[Calendar]]) |
|
||||
|
||||
---
|
||||
|
||||
## Media
|
||||
|
||||
> [!info] File: `routes/media.routes.js` → `controllers/mediaController.js`
|
||||
|
||||
See [[Media System]] for details.
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/media` | All custom media records |
|
||||
| `GET` | `/media/:category/:type/:size/:fileName` | Serve media file |
|
||||
|
||||
**URL pattern:** `/media/{entries|collections|seasons|episodes|peoples}/{posters|backdrops|logos|stills|profiles}/{preview|full}/{filename}`
|
||||
|
||||
---
|
||||
|
||||
## People
|
||||
|
||||
> [!info] File: `routes/people.routes.js` → `controllers/peopleController.js`
|
||||
|
||||
See [[People]] for the lazy-fetch pattern.
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/people` | All people |
|
||||
| `GET` | `/people/popular?limit=` | Popular people (local DB) |
|
||||
| `GET` | `/people/search?query=` | Search people (local DB) |
|
||||
| `GET` | `/people/:id` | Person by ID (lazy-fetch from TMDB if needed) |
|
||||
| `GET` | `/people/:id/credits` | Person's credits |
|
||||
| `GET` | `/people/:id/tmdb-filmography` | Full TMDB filmography |
|
||||
| `POST` | `/people` | Create person |
|
||||
| `POST` | `/people/fetch` | Fetch by TMDB ID: `{ tmdb_id }` |
|
||||
| `PUT` | `/people/:id` | Update person |
|
||||
| `PUT` | `/people/:id/refresh` | Refresh from TMDB |
|
||||
| `DELETE` | `/people/:id` | Delete person |
|
||||
| `POST` | `/people/:id/media` | Upload profile picture |
|
||||
| `GET` | `/people/tmdb/popular` | TMDB popular people |
|
||||
| `GET` | `/people/tmdb/search?query=` | TMDB people search |
|
||||
|
||||
---
|
||||
|
||||
## Statistics
|
||||
|
||||
> [!info] File: `routes/statistics.routes.js` → `controllers/statisticsController.js`
|
||||
|
||||
See [[Statistics]] for chart details.
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/statistics/watch-time` | All-time watch time (series + movies, in minutes) |
|
||||
| `GET` | `/statistics/watch-time/year/:year` | Yearly watch time by month |
|
||||
| `GET` | `/statistics/watch-count/year/:year` | Yearly watch count by month |
|
||||
| `GET` | `/statistics/watch-weekday` | Watch-day distribution (EXACT accuracy only) |
|
||||
|
||||
---
|
||||
|
||||
## Settings
|
||||
|
||||
> [!info] File: `routes/settings.routes.js` → `controllers/settingsController.js`
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/settings` | Get all settings |
|
||||
| `PUT` | `/settings` | Update settings |
|
||||
|
||||
---
|
||||
|
||||
## Maintenance
|
||||
|
||||
> [!info] File: `routes/maintenance.routes.js` → `controllers/maintenanceController.js`
|
||||
|
||||
See [[Settings Page#Cleanup]] for the UI.
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/maintenance/orphan-files` | Dry scan — files on disk without DB records |
|
||||
| `DELETE` | `/maintenance/orphan-files` | Delete orphan files |
|
||||
| `GET` | `/maintenance/orphan-media-records` | Dry scan — DB records without files on disk |
|
||||
| `DELETE` | `/maintenance/orphan-media-records` | Delete orphan DB records |
|
||||
|
||||
**Response:** `{ posters: number, logos: number, backdrops: number, stills: number }`
|
||||
|
||||
---
|
||||
|
||||
## Import
|
||||
|
||||
> [!info] File: `routes/import.routes.js` → `controllers/importController.js`
|
||||
|
||||
See [[Import System]] for details.
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `POST` | `/import/movies` | Bulk import movies |
|
||||
| `POST` | `/import/tmdb` | Bulk import by TMDB IDs |
|
||||
| `POST` | `/import/episodes-watch-history` | Bulk import episode watch history |
|
||||
|
||||
---
|
||||
|
||||
## Utility
|
||||
|
||||
| Method | Path | Description |
|
||||
|---|---|---|
|
||||
| `GET` | `/ping` | Health check → `{ message: 'pong' }` |
|
||||
| `GET/POST` | `/killer` | Debug: crash backend (outside `/api/v1`) |
|
||||
Reference in new issue
Block a user