OpenFolia

Save a manual’s working copy

PUT
/change-sets/{changeSetId}/manuals/{manualId}/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 manual whose committed manifest names modules the author may not see is refused (403).

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
manualId*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/manuals/operating/working-copy' \  -H 'Content-Type: application/vnd.api+json' \  -d '{  "data": {    "type": "WorkingCopy",    "attributes": {      "content": {        "schemaVersion": 1,        "id": "string",        "title": "string",        "variants": [          {            "property1": "string",            "property2": "string"          }        ],        "attributes": {},        "entries": [          {            "module": "string"          }        ]      }    }  },  "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",        "kind": "derived",        "title": "string",        "audience": "string",        "deprecated": {          "reason": "string",          "replacedBy": "string"        },        "glossary": true,        "design": "string",        "coverImage": {          "default": {            "asset": "string",            "alt": "string"          },          "variants": []        },        "translations": {          "property1": {            "sourceCommit": "string",            "blocks": {              "property1": "string",              "property2": "string"            }          },          "property2": {            "sourceCommit": "string",            "blocks": {              "property1": "string",              "property2": "string"            }          }        },        "variants": [          {            "property1": "string",            "property2": "string"          }        ],        "attributes": {},        "rule": {          "source": "string",          "moduleTypes": [            "string"          ],          "exclude": [],          "front": [],          "back": [],          "notices": {            "groupBy": "module",            "levels": [              "danger"            ]          }        },        "entries": [          {            "module": "string",            "when": {              "op": "all",              "of": [                null,                null              ]            }          }        ]      },      "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"        }      ]    }  }}