OpenFolia

Change a module’s ID

POST
/change-sets/{changeSetId}/module-renames

Changes a module’s ID (#265): one commit on the change set’s branch, made as a save point is, that writes every language of the module under the new ID (with its translation record), deletes the old files, and rewrites every module reference, cross-reference and manifest entry naming the old ID at the branch head, and the replacedBy of every module deprecated in favour of it. The change set’s comments on the module follow it, with a module.rename audit event per language (and the commit’s own). Only the change set’s author, while it is a draft. It needs the change set to hold the locks of the module under both IDs, in every language, and of every module and manual it rewrites (GET /change-sets/{changeSetId}/module-references/{moduleId} lists them); their working copies must be committed or discarded first. Anything it touches outside the actor’s scope is one 403. Releases keep the old ID; it is not kept as an alias. Needs the content.edit permission.

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

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*

Response Body

Renamed: the commit.

application/vnd.api+json
  1. response
data*

id is the rename’s commit.

Example Request
curl -X POST 'http://localhost:3000/change-sets/497f6eca-6276-4993-bfeb-53cbbbba6f08/module-renames' \  -H 'Content-Type: application/vnd.api+json' \  -d '{  "data": {    "type": "ModuleRename",    "attributes": {      "from": "string",      "to": "string"    }  }}'
Example Response
{  "data": {    "type": "ModuleRename",    "id": "string",    "attributes": {      "from": "string",      "to": "string",      "branch": "string",      "parent": "string",      "message": "string",      "languages": [        "string"      ],      "rewritten": [        {          "type": "module",          "lang": "string",          "moduleId": "string"        }      ]    },    "relationships": {      "changeSet": {        "data": {          "type": "ChangeSet",          "id": "string"        }      }    },    "meta": {      "comments": -9007199254740991    }  }}