OpenFolia

Read a template file’s working copy

GET
/change-sets/{changeSetId}/page-design-templates/{templateId}/files/working-copy

The change set’s working copy, else the file committed on its branch (version 0, meta.saved false), with its validation issues. Only the change set’s author works on its working copies (403 for anyone else who holds content.read.draft; for anyone else another author’s change set is 404, exactly like a missing one). What lies outside the reader’s scope (their content.read.draft roles; for an author without that permission, their content.read roles) is not found. Reads with ?ref= on the branch keep showing the committed file. Needs the content.read permission. A committed file that is no UTF-8 text (an image the template shows) reads as none.

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.

Path Parameters

changeSetId*string

The change set’s ID (a UUID). One that names no change set, malformed or not, is 404.

Formatuuid
templateId*string
Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Lengthlength <= 100

Query Parameters

path*string

The file’s path in the template’s folder (templates/<templateId>/<path>): names of letters, digits, _, - and . joined by /, none starting with ., at most 8 deep and 150 characters, ending in a text file’s extension (.typ, .yaml, .yml, .json, .toml, .csv, .txt, .xml, .svg, .bib). Any other path is 404, never a file outside the folder.

Lengthlength <= 1000

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*

id is <changeSetId>/module/<lang>/<moduleId>, <changeSetId>/manual/<manualId>, <changeSetId>/config, <changeSetId>/term/<termId>, <changeSetId>/design/<designId> or <changeSetId>/template/<templateId>/<path>.

Example Request
curl -X GET 'http://localhost:3000/change-sets/497f6eca-6276-4993-bfeb-53cbbbba6f08/page-design-templates/house/files/working-copy?path=parts%2Fnotice.typ'
Example Response
{  "data": {    "type": "WorkingCopy",    "id": "string",    "attributes": {      "subject": {        "type": "module",        "lang": "string",        "moduleId": "string"      },      "content": {        "schemaVersion": 1,        "text": "string"      },      "version": 0,      "baseCommit": "string",      "updatedBy": {        "kind": "user",        "id": "string"      },      "updatedAt": "2019-08-24T14:15:22Z"    },    "relationships": {      "changeSet": {        "data": {          "type": "ChangeSet",          "id": "string"        }      }    },    "meta": {      "saved": true,      "issues": [        {          "severity": "error",          "code": "string",          "message": "string",          "at": "string"        }      ]    }  }}