OpenFolia

Save a page design’s working copy

PUT
/change-sets/{changeSetId}/page-designs/{designId}/working-copy

Autosave: stores the editor’s content as the change set’s working copy (Postgres), without a commit and without an audit event; a save point commits it later. The shape is checked (400 otherwise); validation issues come back in meta.issues without refusing it, since a draft may be incomplete. Send meta.version: the version last read or saved (0 for none yet); the answer has the next one. Send meta.baseCommit: the commit the content is based on. 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). Needs the change set to be a draft holding the subject’s lock, and the content.edit permission covering the content (and the committed file). A page design (#390) needs content.edit through a role whose scope restricts nothing: it is every manual's look that uses it, in every language. Its meta.issues say where in the design (at, a dotted path; a region's block after #).

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
designId*string
Match^[a-z0-9]+(?:-[a-z0-9]+)*$
Lengthlength <= 100

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).

Request Body

application/vnd.api+json
  1. body
data*
meta*

Response Body

Saved, at its new version.

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 PUT 'http://localhost:3000/change-sets/497f6eca-6276-4993-bfeb-53cbbbba6f08/page-designs/product-line/working-copy' \  -H 'Content-Type: application/vnd.api+json' \  -d '{  "data": {    "type": "WorkingCopy",    "attributes": {      "content": {        "schemaVersion": 1,        "id": "string",        "name": "string",        "preset": "string",        "page": {          "size": "a4",          "margins": {            "top": 26,            "right": 22,            "bottom": 24,            "left": 22          },          "doubleSided": false        },        "colours": {          "primary": "string",          "accent": "string",          "text": "string"        },        "fonts": {          "embeddingAllowed": false        },        "titlePage": {          "fields": [            "title",            "variant",            "language",            "release",            "date"          ]        },        "regions": {},        "header": {          "default": {            "left": [              {                "type": "placeholder",                "key": "title"              }            ],            "right": [              {                "type": "placeholder",                "key": "variant"              }            ]          }        },        "footer": {          "default": {            "left": [              {                "type": "placeholder",                "key": "language"              }            ],            "right": [              {                "type": "placeholder",                "key": "page"              }            ]          }        },        "headings": {          "numbering": [            "decimal"          ],          "sizes": [            "3xl",            "2xl",            "xl",            "base"          ],          "colour": "text",          "pageBreakBeforeLevel1": true        },        "body": {          "fontSize": 10,          "lineHeight": 1.45,          "paragraphSpacing": 7,          "columns": 1        },        "tables": {          "headerTint": true,          "borders": "horizontal",          "zebra": false        },        "steps": {          "marker": "filled-circle"        },        "notes": {          "style": "tinted"        },        "safety": {          "standard": "ansi-z535"        }      }    }  },  "meta": {    "version": 0,    "baseCommit": "string"  }}'
Example Response
{  "data": {    "type": "WorkingCopy",    "id": "string",    "attributes": {      "subject": {        "type": "module",        "lang": "string",        "moduleId": "string"      },      "content": {        "schemaVersion": 1,        "id": "string",        "name": "string",        "preset": "string",        "template": "string",        "page": {          "size": "a4",          "margins": {            "top": 26,            "right": 22,            "bottom": 24,            "left": 22          },          "doubleSided": false        },        "colours": {          "primary": "string",          "accent": "string",          "text": "string"        },        "fonts": {          "embeddingAllowed": false        },        "logo": {          "light": "string",          "dark": "string"        },        "titlePage": {          "fields": [            "title",            "variant",            "language",            "release",            "date"          ]        },        "regions": {},        "translations": {          "property1": {            "sourceCommit": "string",            "blocks": {              "property1": "string",              "property2": "string"            }          },          "property2": {            "sourceCommit": "string",            "blocks": {              "property1": "string",              "property2": "string"            }          }        },        "coverImage": {          "default": {            "asset": "string",            "alt": "string"          },          "variants": []        },        "backPage": {          "position": "last",          "copyright": "string",          "documentNumber": true,          "date": true        },        "header": {          "default": {            "left": [              {                "type": "placeholder",                "key": "title"              }            ],            "right": [              {                "type": "placeholder",                "key": "variant"              }            ]          }        },        "footer": {          "default": {            "left": [              {                "type": "placeholder",                "key": "language"              }            ],            "right": [              {                "type": "placeholder",                "key": "page"              }            ]          }        },        "headings": {          "numbering": [            "decimal"          ],          "sizes": [            "3xl",            "2xl",            "xl",            "base"          ],          "colour": "text",          "pageBreakBeforeLevel1": true        },        "body": {          "fontSize": 10,          "lineHeight": 1.45,          "paragraphSpacing": 7,          "columns": 1        },        "tables": {          "headerTint": true,          "borders": "horizontal",          "zebra": false        },        "steps": {          "marker": "filled-circle"        },        "notes": {          "style": "tinted"        },        "safety": {          "standard": "ansi-z535"        }      },      "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"        }      ]    }  }}