OpenFolia

Validate a translation import

POST
/translations/imports

Reads an uploaded XLIFF 2.0 document of a translation job (GET /translations/exports/{jobId}/file, translated), or a ZIP of them (one per target language), or a COTI level 1 package a translation management system returned (GET /translations/exports/{jobId}/package: each project’s COTI.xml names the job, its package-id, and the XLIFF files to read; nothing else in it is read), and decides each unit against what the job sent (read at its commit, as you read it there) and the base branch baseRef (default the server's default branch), as you see it: ok, source-changed, broken-markup (its <pc> and <ph> do not match its source: missing, extra, reordered across nesting, unknown IDs; refused alone, never the whole file), unknown-block, unknown-module, outside-scope (meta.report, one page per page[number] and page[size], with the counts in meta.counts). The XML is read strictly: no DTD and no entities but the predefined ones, bounded in length, depth and nodes. Nothing is written: the documents and the report are kept for an hour (attributes.expiresAt), in the server's memory, so the import can be applied (POST /translations/imports/{importId}/apply). Send multipart/form-data (with X-Ccms-Request) with the file in the part file (at most CCMS_MAX_UPLOAD_BYTES) and the optional fields dryRun (true, the only value) and baseRef. Needs translation.manage for each document's target language.

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.

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-Request?string

Required (any non-empty value) with a body of type multipart/form-data: a cross-site form cannot send it. Not needed with application/vnd.api+json.

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

multipart/form-data
  1. body
file*unknown

An XLIFF 2.0 document, a ZIP of them, or a COTI package.

dryRun?"true"
Value in"true"
baseRef?string

Response Body

Checked and kept, to be applied within the hour.

application/vnd.api+json
  1. response
data*
meta*
links*
Example Request
curl -X POST 'http://localhost:3000/translations/imports' \  -F 'file=null'
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"  }}