Skip to content

ffl_core.api.photos

Source: apps/ffl_core/ffl_core/api/photos.py · 6 endpoint(s)

Generated by make api-docs — do not edit by hand.

POST /api/method/ffl_core.api.photos.add_gallery_images

Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).

Append already-uploaded photos to a document's gallery in ONE save.

arg type required default description
doctype string yes — Item or Serial No.
name string yes — the document.
file_urls array yes — /files/... URLs of Files already on this site (the Frappe uploader creates them); a JSON string is accepted.

Returns: list[dict]: the gallery in publish order — name, image, is_primary, sort_order, caption per row.

Notes: Files are made public. A URL already in the gallery is skipped. The first photo of an empty gallery becomes primary (validate hook); an existing featured photo is never displaced by an upload.

apps/ffl_core/ffl_core/api/photos.py:121

POST /api/method/ffl_core.api.photos.remove_gallery_image

Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).

Remove a photo from the gallery; delete the file only when nothing else uses it.

arg type required default description
doctype string yes — Item or Serial No.
name string yes — the document.
row_name string yes — the gallery row to remove.

Returns: list[dict]: the remaining gallery in publish order.

Notes: The same photo may sit on an Item AND on one of its serials; the File is deleted only when no gallery row and no image field anywhere still points at it. Removing the last photo clears the document's image.

apps/ffl_core/ffl_core/api/photos.py:230

POST /api/method/ffl_core.api.photos.reorder_gallery

Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).

Persist the order the operator dragged the photos into.

arg type required default description
doctype string yes — Item or Serial No.
name string yes — the document.
row_names array yes — every gallery row name, in the new order; JSON string accepted. Must be exactly the current set of rows.

Returns: list[dict]: the gallery in publish order (primary always first).

apps/ffl_core/ffl_core/api/photos.py:161

serials_for_item

POST /api/method/ffl_core.api.photos.serials_for_item

Auth (derived from code): Requires read permission on Serial No (Frappe DocType permission check).

The serials of one Item with their photo counts, for the upload-by-serial page.

arg type required default description
item_code string yes — the Item.
in_stock_only integer no 1 1 = only status = Active serials (default), 0 = all.
search string no '' optional substring filter on the serial number.

Returns: list[dict]: per serial — serial_no, status, warehouse, image, photo_count, thumbs (first few photo URLs in publish order). Newest serials first, capped at 500.

apps/ffl_core/ffl_core/api/photos.py:265

set_image_caption

POST /api/method/ffl_core.api.photos.set_image_caption

Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).

Set a photo's caption (also used as its alt text).

arg type required default description
doctype string yes — Item or Serial No.
name string yes — the document.
row_name string yes — the gallery row.
caption string no '' the new caption; blank clears it.

Returns: list[dict]: the gallery in publish order.

apps/ffl_core/ffl_core/api/photos.py:210

set_primary_image

POST /api/method/ffl_core.api.photos.set_primary_image

Auth (derived from code): Any authenticated user — no explicit role gate at function entry (deliberate open reads document this in Permissions).

Make one gallery photo the featured image.

arg type required default description
doctype string yes — Item or Serial No.
name string yes — the document.
row_name string yes — the gallery row to feature.

Returns: list[dict]: the gallery in publish order; exactly one row is primary and the document's image mirrors it.

apps/ffl_core/ffl_core/api/photos.py:187