OpenFolia

Save a module’s working copy

PUT
/change-sets/{changeSetId}/modules/{lang}/{moduleId}/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).

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
lang*string

A language with subtags of 2 to 8 characters (en, pt-BR); any case. One that is not is 404.

moduleId*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/modules/en/battery-charging/working-copy' \  -H 'Content-Type: application/vnd.api+json' \  -d '{  "data": {    "type": "WorkingCopy",    "attributes": {      "content": {        "schemaVersion": 1,        "id": "string",        "meta": {          "title": "string",          "type": "string",          "lang": "string",          "facets": {}        },        "blocks": [          {            "type": "paragraph",            "id": "string",            "content": [              {                "type": "text",                "text": "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",        "meta": {          "title": "string",          "type": "string",          "lang": "string",          "audience": "string",          "facets": {},          "keywords": [            "string"          ],          "source": {            "system": "string",            "id": "string"          },          "deprecated": {            "reason": "string",            "replacedBy": "string"          }        },        "blocks": [          {            "type": "paragraph",            "id": "string",            "content": [              {                "type": "text",                "text": "string",                "marks": [                  {                    "type": "strong"                  }                ]              }            ]          }        ]      },      "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"        }      ]    }  }}