API documentation - nuanxed/MateCat-Filters GitHub Wiki

All the endpoints accept data as POST calls with Content-Type multipart/form-data.

The returned value is always a JSON.

POST /AutomationService/original2xliff

Example:

$ curl 'http://localhost:8732/AutomationService/original2xliff' \
  -F '[email protected]' \
  -F 'sourceLocale=en-GB' \
  -F 'targetLocale=it-IT'
{
  "filename":"source.docx.xlf",
  "xliffContent":"<?xml version=\"1.0\" encoding=\"UTF-8\"...
  "isSuccess":true
}

Input params

Param Description
documentContent The binary content of the source file
sourceLocale The source language of the file in ISO 639 format
targetLocale The target language of the file in ISO 639 format
segmentation Optional custom segmentation rules file (see the custom-segmentation-folder parameter in config.sample.properties)

Output fields

Field Description
filename The name of the XLIFF file returned
xliffContent The contents of the XLIFF file, in plain text
isSuccess True if everything is ok, otherwise false
errorMessage A description of the exception encountered; returned only if isSuccess is false

POST /AutomationService/xliff2original

Example:

$ curl 'http://localhost:8732/AutomationService/xliff2original' \
  -F '[email protected]'
{
  "filename":"source.out.docx",
  "documentContent":"lbnRfVHlwZXNdLnhtbLWUy2rDMBBF94...
  "isSuccess":true
}

Input params

Param Description
xliffContent The binary content of the XLIFF file

Output fields

Field Description
filename The name of the source file extracted
documentContent The binary content of the source file, Base64 encoded
isSuccess True if everything is ok, otherwise false
errorMessage A description of the exception encountered; returned only if isSuccess is false

POST /AutomationService/xliff2source

Example:

$ curl 'http://localhost:8732/AutomationService/xliff2source' \
  -F '[email protected]'
{
  "filename":"source.docx",
  "documentContent":"UEsDBBQACAgIAM94akcAAAAAAAAA...
  "isSuccess":true
}

Input params

Param Description
file The binary content of the XLIFF file

Output fields

Field Description
filename The name of the output file returned
documentContent The binary content of the output file, Base64 encoded
isSuccess True if everything is ok, otherwise false
errorMessage A description of the exception encountered; returned only if isSuccess is false

GET /test

This endpoint just "pings" the server. Example:

$ curl 'http://localhost:8732/test'
Server on

Notes on the XLIFFs produced by MateCat Filters

The XLIFF produced by MateCat Filters are fully compliant with the XLIFF 1.2 specification.

The only peculiarity is in the first two <file> elements. The first <file> is used to carry the original document. The second <file> carries a manifest file with infos on the conversion steps performed. Both don't contain translation units, they just contain the binary data of the respective files encoded in Base64. They are needed by MateCat Filters to properly convert the XLIFF back to the original format.

⚠️ **GitHub.com Fallback** ⚠️