OpenFolia

Apply a translation import

POST
/translations/imports/{importId}/apply

Checks the stored documents again against the base as it is now, then, as you, through the change-set actions: starts a change set (named after the job, from the import’s base), locks each target module, writes each as a working copy with its units merged in by block ID (a block the target lacks comes from the source’s structure; image and attachment references, variant conditions and IDs of the target stay), and makes one save point with the working copies and each module’s translation record (the source hash each unit was exported from). Imported: ok units, and source-changed ones unless meta.decisions says skip (keep is the default; they stay outdated). In the save point’s transaction the job’s units imported become returned (the job too once none is left at the provider), with one translation.import audit event and a translation.imported outbox row (webhooks, notifications). The change set then goes through review like any other. Takes no body, or { meta: { decisions } } (send Content-Type: application/vnd.api+json). A failure abandons the change set (nothing is committed) and leaves the import validated. Only the import’s uploader, once, within the hour. Needs translation.manage, and content.edit with the scope of every module written (as saving it would).

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

importId*string

The translation import’s ID (a UUID). One that names no stored import, malformed or not, someone else’s or one removed after it expired, is 404.

Formatuuid

Query Parameters

page[number]?integer

Page to return, from 1. Default: 1.

Range1 <= value
page[size]?integer

Resources per page. Default: 50, at most 200.

Range1 <= value <= 200

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
meta?

Response Body

Applied: the import with its change set and commit.

application/vnd.api+json
  1. response
data*
meta*
links*
Example Request
curl -X POST 'http://localhost:3000/translations/imports/497f6eca-6276-4993-bfeb-53cbbbba6f08/apply' \  -H 'Content-Type: application/vnd.api+json' \  -d '{}'
Example Response
{  "data": {    "type": "TranslationImport",    "id": "string",    "attributes": {      "languages": [        "string"      ],      "baseRef": "string",      "baseCommit": "string",      "state": "validated",      "createdBy": {        "kind": "user",        "id": "string"      },      "createdAt": "2019-08-24T14:15:22Z",      "expiresAt": "2019-08-24T14:15:22Z"    },    "relationships": {      "job": {        "data": {          "type": "TranslationJob",          "id": "string"        }      },      "changeSet": {        "data": {          "type": "ChangeSet",          "id": "string"        }      }    },    "meta": {      "counts": {        "units": 0,        "ok": 0,        "sourceChanged": 0,        "brokenMarkup": 0,        "unknownBlock": 0,        "unknownModule": 0,        "outsideScope": 0      },      "report": [        {          "lang": "string",          "moduleId": "string",          "designId": "string",          "manualId": "string",          "config": true,          "title": "string",          "units": [            {              "blockId": "string",              "state": "ok",              "reason": "string",              "kind": "string",              "detail": "string",              "texts": {                "exported": "string",                "current": "string",                "target": "string",                "truncated": true              }            }          ]        }      ],      "commit": "string"    }  },  "meta": {    "page": {      "currentPage": -9007199254740991,      "lastPage": -9007199254740991,      "perPage": -9007199254740991,      "total": -9007199254740991    }  },  "links": {    "self": "string",    "first": "string",    "last": "string",    "prev": "string",    "next": "string"  }}