pinakes/docs/api/media.md
NotAShelf 9e5eb41d39
nix: set up project-wide formatter
Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I4806c58aa0a17f504c9312723ad770166a6a6964
2026-03-22 23:58:28 +03:00

639 lines
14 KiB
Markdown
Vendored

# Media
Media item management
## Endpoints
### GET /api/v1/media
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| -------- | ----- | -------- | ----------------- |
| `offset` | query | No | Pagination offset |
| `limit` | query | No | Page size |
| `sort` | query | No | Sort field |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | List of media items |
| 401 | Unauthorized |
| 500 | Internal server error |
---
### DELETE /api/v1/media
**Authentication:** Required (Bearer JWT)
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | All media deleted |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/batch/collection
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | ----------------------- |
| 200 | Batch collection result |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/batch/delete
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Batch delete result |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/batch/move
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Batch move result |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/batch/tag
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Batch tag result |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/batch/update
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Batch update result |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### GET /api/v1/media/count
**Authentication:** Required (Bearer JWT)
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media count |
| 401 | Unauthorized |
| 500 | Internal server error |
---
### POST /api/v1/media/import
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media imported |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/import/batch
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Batch import results |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/import/directory
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | ------------------------ |
| 200 | Directory import results |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/import/options
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media imported |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### POST /api/v1/media/import/preview
**Authentication:** Required (Bearer JWT)
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Directory preview |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### GET /api/v1/media/trash
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| -------- | ----- | -------- | ----------------- |
| `offset` | query | No | Pagination offset |
| `limit` | query | No | Page size |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Trashed media items |
| 401 | Unauthorized |
| 500 | Internal server error |
---
### DELETE /api/v1/media/trash
**Authentication:** Required (Bearer JWT)
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Trash emptied |
| 401 | Unauthorized |
| 403 | Forbidden |
| 500 | Internal server error |
---
### GET /api/v1/media/trash/info
**Authentication:** Required (Bearer JWT)
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Trash info |
| 401 | Unauthorized |
| 500 | Internal server error |
---
### GET /api/v1/media/{id}
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media item |
| 401 | Unauthorized |
| 404 | Not found |
| 500 | Internal server error |
---
### PATCH /api/v1/media/{id}
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Updated media item |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---
### DELETE /api/v1/media/{id}
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media deleted |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---
### PUT /api/v1/media/{id}/custom-fields
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Custom field set |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---
### DELETE /api/v1/media/{id}/custom-fields/{name}
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ------ | ---- | -------- | ----------------- |
| `id` | path | Yes | Media item ID |
| `name` | path | Yes | Custom field name |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Custom field deleted |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---
### POST /api/v1/media/{id}/move
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Moved media item |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---
### POST /api/v1/media/{id}/open
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media opened |
| 401 | Unauthorized |
| 404 | Not found |
| 500 | Internal server error |
---
### DELETE /api/v1/media/{id}/permanent
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ----------- | ----- | -------- | ------------------------------------ |
| `id` | path | Yes | Media item ID |
| `permanent` | query | No | Set to 'true' for permanent deletion |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media deleted |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---
### POST /api/v1/media/{id}/rename
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Request Body
`Content-Type: application/json`
See `docs/api/openapi.json` for the full schema.
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Renamed media item |
| 400 | Bad request |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---
### POST /api/v1/media/{id}/restore
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media restored |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---
### GET /api/v1/media/{id}/stream
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media stream |
| 206 | Partial content |
| 401 | Unauthorized |
| 404 | Not found |
| 500 | Internal server error |
---
### GET /api/v1/media/{id}/thumbnail
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Thumbnail image |
| 401 | Unauthorized |
| 404 | Not found |
| 500 | Internal server error |
---
### DELETE /api/v1/media/{id}/trash
**Authentication:** Required (Bearer JWT)
#### Parameters
| Name | In | Required | Description |
| ---- | ---- | -------- | ------------- |
| `id` | path | Yes | Media item ID |
#### Responses
| Status | Description |
| ------ | --------------------- |
| 200 | Media moved to trash |
| 401 | Unauthorized |
| 403 | Forbidden |
| 404 | Not found |
| 500 | Internal server error |
---