OpenFolia

Save a term’s working copy

PUT
/change-sets/{changeSetId}/terms/{termId}/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 term needs content.edit through one role covering everything in each language it holds, as committed and as sent (its scope restricts nothing but languages).

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
termId*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/terms/charger/working-copy' \  -H 'Content-Type: application/vnd.api+json' \  -d '{  "data": {    "type": "WorkingCopy",    "attributes": {      "content": {        "schemaVersion": 1,        "id": "string",        "status": "proposed",        "languages": {          "property1": {            "preferred": "string",            "allowed": [],            "forbidden": []          },          "property2": {            "preferred": "string",            "allowed": [],            "forbidden": []          }        }      }    }  },  "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",        "status": "proposed",        "domain": "string",        "replacedBy": "string",        "languages": {          "property1": {            "preferred": "string",            "allowed": [],            "forbidden": [],            "definition": [              {                "type": "text",                "text": "string",                "marks": [                  {                    "type": "strong"                  }                ]              }            ],            "usage": "string"          },          "property2": {            "preferred": "string",            "allowed": [],            "forbidden": [],            "definition": [              {                "type": "text",                "text": "string",                "marks": [                  {                    "type": "strong"                  }                ]              }            ],            "usage": "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"        }      ]    }  }}