Content API

The REST API websites read (and write) the content with.

GET  /api/v1/{project}/content                  readable entities with their fields
GET  /api/v1/{project}/content/{entity}         ?page, limit, s, sort=-field, filter[field][op]=…, fields=a,b, include=reference, lang, tree
GET  /api/v1/{project}/content/{entity}/{id}    ?fields, include, lang
POST /api/v1/{project}/oauth/token              grant_type=client_credentials (RFC 6749 §4.4)
DELETE /api/v1/{project}/cache/{key}            an API client removes its cached answers of a key (without: all)

Cache

Answers of GET …/content/{entity} and GET …/content/{entity}/{id} can be kept for a while (Administration › Cache). A rule per entity says for how long (1 second to a day) - either for every request or for one API client; the rule of the client wins over the one for every request. Without a rule nothing is cached.

  • Who shares an answer: nobody - an answer belongs to the client that asked (or to the public requests), as clients may read different entities. The key in the CMS is the project, the client, its key (below) and the request (path and parameters).
  • Keys and times of clients: a rule may let clients choose. A client then sends X-Cache-Key: start (letters, digits, ., _, :, -) and optionally X-Cache-TTL: 600 (seconds, at most the longest time of the rule). The client and its key become the key in the CMS - with DELETE /api/v1/{project}/cache/start the client removes them again, with DELETE /api/v1/{project}/cache all of its answers. Public requests ignore the headers.
  • Always fresh: an answer is removed as soon as a record of its entity - or of an entity its reference fields point to (include) - is created, changed, published, deleted …, when the schema of the entity changes, and when a media file is replaced or deleted. Expired answers are removed by the cleanup.
  • Flush: in the admin app all answers of the project, or those of an entity, a client or a key.
  • Events of the action after_find (Events) change the values of answers - the cache keeps the changed answer.
  • Answers say where they came from: X-Cache: HIT (with Age in seconds) or X-Cache: MISS. Previews are never cached.