Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

errors: [{errorMsg: 'Given tmxData is no TMX.'}]

}

http://opentm2/translationmemory/

POST - creating a new or importing an existing filebased binary OpenTM2 TM

The Parameter „name“ contains the TM Name as a string. The string has a maxlength of 256 chars. It can contain any characters except the characters backslash (\), slash(/), colon (:), question mark (?), asterisk (*), vertical line (|), less than sign (<), and greater than sign (>).

Uploading a file is optional, omitting a file means creating a empty TM only.

If an empty TM is created, the POST request contains only the JSON structure with the TM Name.

If an existing binary OpenTM2 file should be additionally imported to the new TM, the POST must be encoded as multipart/form-data.

The JSON structure with the meta data will then be in the first chunk of the multiparted request, the chunk must be named “meta”.

The second chunk contains the plain binary file content and must be named “data”. This binary data contains the TM content

The resulting body contains the name of the TM, as given in the POST request.

To OpenTM2 – without data / creating an empty TM:

{
sourceLang: “en”, // the source language is required for a new TM
name: „TM Name“
}



Raw POST to OpenTM2 – with provided import file:

POST http://opentm2/translationmemory HTTP/1.1
Content-Type: multipart/form-data; boundary="autogenerated"

-- autogenerated
Content-Type: application/json; charset=utf-8
Content-Disposition: form-data; name=meta

{"name":"TM Name", sourceLang:"en"}

--autogenerated
Content-Type: image/jpeg
Content-Disposition: form-data; name=data; filename=Original Filename.jpg
...TM content ...
--autogenerated--



In both cases from OpenTM2 - HTTP 200 OK:

{

name: „TM Name“

}

Errors:

  • 400 Bad Request – if parameters are missing or are not well formed.
  • 409 Conflict – if a memory with the given name already exists.
  • 500 Server Error – for other technical problems.

http://opentm2/translationmemory/[TM_Name]/import

...

  • 400 Bad Request – if parameters are missing or are not well formed.
  • 404 Not Found – if the memory of the given name does not exist
  • 500 Server Error – for other technical problems.

http://opentm2/translationmemory/

GET – retrieving a list of available TM Files

To OpenTM2: -

From OpenTM2 - HTTP 200 OK:

[{

name: 'my nice TM'

}]

Errors:

  • 500 Server Error – for other technical problems.

http://opentm2/translationmemory/[TM_Name]/

...