OpenFolia

List images and attachments

GET
/assets

The files a module the reader may see shows as an image or attaches at ?ref=, each with its type, size, dimensions (images) and file name (attachments) and, in meta.usedIn, the modules the reader may see that use it (meta.usedAs: how). filter[q] finds files by their alt text, title, attachment name, description and file name and the modules using them. Ordered by the ID of the first such module; with filter[changeSet], the files uploaded into that change set come first (last uploaded first). Content outside the reader’s scope is never listed nor counted: an image only such modules show is not there, and meta.page.total counts only what is listed. The ETag is a hash of the answer (uploads and the blob store change it too), so it is never immutable.

Authorization

bearer
headerAuthorizationBearer <JWT>

A service account's token (ccms_sat_…, issued by POST /service-accounts/{id}/tokens), or, for local use and demo mode, the server's shared CCMS_API_TOKEN.

Query Parameters

filter[q]?string

Only files this text is found in, 1 to 200 characters after trimming (empty: 400): the alt text or title of an image block showing it, the name, description or file name of an attachment block attaching it, or the title or ID of a module showing it, as one piece of text (case and diacritics do not matter); or the file name of its upload into the change set of filter[changeSet]; a whole SHA-256 also finds the file of that hash. Only modules the reader may see are searched, so a file is never found through one outside their scope.

Length1 <= length <= 200
filter[type]?string

Only files of this type: a top-level type (image: every image), a media type (image/png: only PNGs), or attachment: the files an attachment block the reader may see attaches, and uploads into the change set of filter[changeSet] of a type no image or font upload has (decided by the blocks and uploads, so it also lists a missing file); font (or font/ttf, …): the fonts the page designs at ?ref= name and those uploaded into the change set of filter[changeSet], each with attributes.font (its family, style, copyright and licence). Lowercase. A missing file (meta.missing) has no type, so a media type filter never matches it.

Match^[a-z0-9][a-z0-9!#$&^_.+-]{0,62}(\/[a-z0-9][a-z0-9!#$&^_.+-]{0,62})?$
filter[changeSet]?string

A change set of the reader’s own (its ID): its uploaded images are listed too, first, also before a module refers to them. Read at its branch with ?ref=change-sets/<id> to see what its modules show. Only its author: 403 for another reader of drafts, 404 not-found for anyone else and for an ID that names no change set (as for an unknown ref).

Length1 <= length <= 64
filter[lang]?string

Only files a module in this language (that the reader may see) uses: an image block shows it or an attachment block attaches it there. meta.languages names every language using a file.

Match^[a-zA-Z]{2,3}(?:-[A-Za-z0-9]{2,8})*$
filter[unused]?string

true: instead, the files nobody uses, to tidy up: uploads into any change set and files in the blob store that no module file refers to at main, any other branch that is not a change set’s, any tag, the head of any open change set or any working copy, last uploaded or stored more than 24 hours ago (renditions aside), last uploaded first. Each can be deleted (DELETE /assets/{hash}). filter[q] then matches the upload’s file name, filter[type] works as otherwise, filter[changeSet] keeps that change set’s uploads, filter[lang] finds nothing (an unused file has no language). Needs content.read.draft and content.edit, each in a role whose scope restricts nothing (403 otherwise). false: as if left out.

Value in"true""false"
page[number]?integer

Page to return, from 1. Default: 1.

Range1 <= value
page[size]?integer

Resources per page. Default: 50, at most 200.

Range1 <= value <= 200
ref?string

Branch, tag or commit ID to read from. Default: the server's CCMS_DEFAULT_REF.

Header Parameters

X-Ccms-User?string

Demo mode only (CCMS_AUTH_MODE=demo): the user ID to act as. The bearer token is still required; without demo mode the header is refused (400).

Response Body

application/vnd.api+json
  1. response
data*array<>
meta*
links*
Example Request
curl -X GET 'http://localhost:3000/assets'
Example Response
{  "data": [    {      "type": "Asset",      "id": "string",      "attributes": {        "reference": "string",        "fileName": "string",        "contentType": "string",        "size": 0,        "width": 1,        "height": 1,        "font": {          "format": "ttf",          "family": "string",          "subfamily": "string",          "weight": 1,          "italic": true,          "copyright": "string",          "licence": "string",          "licenceUrl": "string"        }      },      "meta": {        "usedIn": [          {            "moduleId": "string",            "lang": "string",            "title": "string"          }        ],        "usedInCount": 0,        "usedInManuals": [          {            "manualId": "string",            "title": "string"          }        ],        "languages": [          "string"        ],        "usedAs": [          "image"        ],        "uploaded": true,        "missing": true      }    }  ],  "meta": {    "page": {      "currentPage": -9007199254740991,      "lastPage": -9007199254740991,      "perPage": -9007199254740991,      "total": -9007199254740991    }  },  "links": {    "self": "string",    "first": "string",    "last": "string",    "prev": "string",    "next": "string"  }}