Skip to content

Collection ​

Bulk operations on contributions (content entries). This is the primary endpoint for querying and managing content.

Note: The database entity is called Contributions. Field values are stored in Data rows.

Routes ​

MethodPathAuthDescription
GET/api/collection/:chapter?BearerQuery contributions
PUT/api/collection/:chapter?JWTBulk insert (max 50)
PATCH/api/collection/:chapter?JWTBulk update (max 50)
DELETE/api/collection/:chapter?JWTBulk delete

The optional :chapter path parameter scopes operations to a specific chapter.

Query Collection ​

GET /api/collection?query=<JSON>
GET /api/collection/:chapter?query=<JSON>

Query Parameters ​

ParameterTypeDefaultMaxDescription
whereobject——Filter conditions (required)
limitnumber10001000Maximum results
offsetnumber0—Skip first N results
sortstring/object——Sort specification
depthnumber13Levels of references resolved in relation fields
schemabooleanfalse—Return JSON Schema instead of data
typestring——Set to "ts" to return TypeScript types instead of JSON Schema (requires schema: true)
metabooleanfalse—Metadata only (omit field values)
referencedboolean/objectfalse—Include the referencing contributions: true or {depth, limit} (default depth 1, limit = limit), see Referenced
fieldsarrayall—Restrict to specific fields (by name)
whereBoolstring$and—Logical operator: $and or $or

Filterable Where Fields ​

FieldTypeOperators
$andarrayArray of nested where-clauses, combined with AND
$orarrayArray of nested where-clauses, combined with OR
bookname or idAll operators (accepts name string or numeric id)
chaptername or idAll operators (accepts name string or numeric id)
fieldsobjectKey-value map: {"FieldName": {"$like": "value"}}
issuename or idAll operators (accepts name string or numeric id)
templatename or idAll operators (accepts name string or numeric id)
idnumberAll numeric operators
newdatenumberAll numeric operators
moddatenumberAll numeric operators
namestringAll string operators
statusstringAll string operators

Response Format ​

json
{
  "items": [
    {
      "id": 1,
      "name": "My Article",
      "sort": 1,
      "fields": {
        "Title": "Breaking News",
        "Body": "<p>Content here</p>"
      },
      "created": 1700000000,
      "lastmodified": 1700100000,
      "status": "Open",
      "book": {"id": 1, "name": "Publications"},
      "chapter": {"id": 1, "name": "News"},
      "issue": {"id": 1, "name": "2025-01"},
      "template": {"id": 1, "name": "Article"}
    }
  ],
  "_count": 42,
  "_limit": 1000,
  "_offset": 0
}

id, name, sort (number or null) and fields are always present. created, lastmodified, status, config, book, chapter, issue and template are only included with meta: true. The same applies to GET /api/item/:id.

Examples ​

bash
# List all contributions for a template
curl -G http://localhost:8080/api/collection \
  -H "Authorization: Bearer API_KEY" \
  --data-urlencode 'query={"where":{"template":"Article"},"limit":20,"sort":{"newdate":"DESC"}}'
bash
# Full-text search in field content
curl -G http://localhost:8080/api/collection \
  -H "Authorization: Bearer API_KEY" \
  --data-urlencode 'query={"where":{"fields":{"Title":{"$fulltext":"climate"}}}}'
bash
# Metadata only (fast, no field data)
curl -G http://localhost:8080/api/collection \
  -H "Authorization: Bearer API_KEY" \
  --data-urlencode 'query={"where":{"book":"Reports"},"meta":true}'
bash
# With the contributions referencing each result: 10 at most, without their fields
curl -G http://localhost:8080/api/collection \
  -H "Authorization: Bearer API_KEY" \
  --data-urlencode 'query={"where":{"template":"Category"},"limit":50,"referenced":{"depth":0,"limit":10}}'

Bulk Insert (PUT) ​

PUT /api/collection/:chapter?

Send an array of contribution objects (maximum 50 per request). Items are created sequentially; the response is an array of {status, id, name} objects in request order.

To upload files, send the request as multipart/form-data: the JSON array goes into the form field payload (as a string), the binaries into one or more files parts. See File Uploads.

Body (per item) ​

FieldTypeRequiredDescription
namestringYesDisplay name
sortnumberNoSort order
statusenum: Close, Draft, Open, Deleted, close, draft, open, deletedNoStatus value
creatednumberNoCreation timestamp (unix)
lastmodifiednumberNoLast modified timestamp (unix)
configobjectNoConfiguration object
chapterobjectnumberstring
bookobjectnumberstring
issueobjectnumberstring
templateobjectnumberstring
fieldsobjectNoField values (keyed by field name)

Example ​

bash
curl -X PUT http://localhost:8080/api/collection \
  -H "Authorization: Bearer JWT_TOKEN" \
  -H "Content-Type: application/json" \
  -d '[
    {"name": "Entry 1", "template": "Article", "chapter": 1, "fields": {"Title": "First"}},
    {"name": "Entry 2", "template": "Article", "chapter": 1, "fields": {"Title": "Second"}}
  ]'
bash
# Two entries, each with an image — all files share one "files" pool
curl -X PUT http://localhost:8080/api/collection/1 \
  -H "Authorization: Bearer JWT_TOKEN" \
  -F 'payload=[
    {"name": "Entry 1", "fields": {"Image": [{"key": "one.jpg", "action": "upload"}]}},
    {"name": "Entry 2", "fields": {"Image": [{"key": "two.jpg", "action": "upload"}]}}
  ]' \
  -F "files=@./one.jpg" \
  -F "files=@./two.jpg"

Bulk Update (PATCH) ​

PATCH /api/collection/:chapter?

Send an array of objects with id and fields to update (maximum 50). Each item behaves like PATCH /api/item/:id. There is no bulk POST.

File uploads work as for bulk insert: multipart/form-data with the JSON array in payload and the binaries in files. See File Uploads.

Body (per item) ​

FieldTypeRequiredDescription
idnumberNoEntity ID
namestringNoDisplay name
sortnumberNoSort order
statusenum: Close, Draft, Open, Deleted, close, draft, open, deletedNoStatus value
configobjectNoConfiguration object
chapternumberstringNo
issuenumberstringNo
templatenumberstringNo
fieldsobjectNoField values (keyed by field name)

Example ​

bash
curl -X PATCH http://localhost:8080/api/collection \
  -H "Authorization: Bearer JWT_TOKEN" \
  -F 'payload=[
    {"id": 42, "fields": {"Image": [{"key": "cover.jpg", "action": "upload"}]}},
    {"id": 43, "fields": {"Image": [{"key": "old.jpg", "action": "delete"}]}}
  ]' \
  -F "files=@./cover.jpg"

Bulk Delete ​

DELETE /api/collection/:chapter?query=<JSON>

Deletes all contributions matching the query filter. Uses the same where syntax as GET.

Response: {"status": "ok", "affected_items": 5}

Caching ​

GET requests are cached in Redis (when available). The cache key is derived from the query parameters and the caller's rights. Write operations invalidate only the affected responses: those rendering a changed contribution, those listing the chapter it belongs to, and collections not restricted to a chapter. Changes to templates, fields, books, issues, chapters or rights invalidate the whole cache. Cached entries have no expiry by default (set REDIS_CACHE_TTL in seconds to add one); Redis evicts them when its memory is full.