Using Browsers Development Tools
Best way to get examples is to use the browsers development tools to capture the browsers network communication while using translate5 through the frontend.
All below listed curl examples are generated via Google Chromes DevTools.
Authentication (POST example)
First of all we have to authenticate us at the translate5 installation.The authentication is session based.
To authenticate we POST the data parameter containing the JSON data to the /editor/session URL.
On success this results in a similar JSON as the following. All further calls need the returned sessionId then.
List translation tasks (GET examples)
As next step we can list all tasks available in translate5.
On success this results in a JSON containing the first (start=0) 20 (limit=20) tasks in translate5.
To get a single task you need the task id (from the above returned JSON), then you can access the single task (replace TASKID accordingly):
On success this results in a JSON containing the requested task.
Change Taskname (PUT example)
We change the taskname just to demonstrate a PUT request to change a data entity on the server.
To update the taskname the TASKID is needed again, also the entityVersion of the task. The entityVersion is contained in the previously fetched task entity. It is needed to prevent that two different users change an entity at the same time.
On success this results in a JSON containing the changed task.
Import Task (POST example with fileupload)
Due historical reasons coming from the used frontend framework, POST requests containing file uploads are different as the above shown POSTs without files.
A POST with fileupload contains the entities attributes not as JSON, but as plain form fields. This a known caveat.
Please change also the XLF file path to the file which should be uploaded.
On success this results in a JSON containing the importing task.