manage_media
Create, update, delete, and retrieve media files in Gramps, including uploads, thumbnails, OCR, and face detection.
Instructions
Manage Gramps Media objects and their files. Writes: create, update, delete, upload.
Standard CRUD via /media/ plus binary operations:
get/create/update/delete -> as in manage_person (GET/POST/PUT/DELETE).
upload -> POST /media/ streaming file_path bytes with
mime_type (required); the API computes the
checksum and creates the Media row.
file -> GET /media//file; returns base64 bytes.
thumbnail -> GET /media//thumbnail/; returns
base64 image; pass {"square": true} in query.
ocr -> GET /media//ocr; returns OCR text.
face_detection -> GET /media//face_detection; returns
detected/test faces (see upstream for params).
Repeat action for repeated sub-actions; 'create' accepts a Media JSON body
in data (needs an already-uploaded file), while 'upload' bulk-loads a
local file. Consider merge_objects for duplicate media.
Args: action: "get", "create", "update", "delete", "upload", "file", "thumbnail", "ocr" or "face_detection". handle: Media handle; required for get-one, update, delete, file, thumbnail, ocr, face_detection. data: The Media object for create/update (required for those). query: Optional dict of extra query-string parameters (e.g. {"square": true}). file_path: Local file path for the 'upload' action (required there). mime_type: MIME type of the upload (e.g. 'image/jpeg'); required for 'upload'. size: Thumbnail target size in pixels (required for 'thumbnail'). instance: Gramps Web base URL from get_instances; default = first.
Returns: dict: {"status", "url", "data"} where binary results carry base64/mimetype.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| data | No | ||
| size | No | ||
| query | No | ||
| action | Yes | ||
| handle | No | ||
| instance | No | ||
| file_path | No | ||
| mime_type | No |