GALAglobal / translationapi

The API is for anyone who wants to adopt best practices for a translation services API to interact with counterparts directly from your application or content management system. The API helps ensure interoperability for the most common tasks.
https://translate.taus.net/translate/taus-translation-api
MIT License
12 stars 3 forks source link

PATCHing translation requests does not work #28

Closed achimr closed 9 years ago

achimr commented 9 years ago
  1. Start server with "node tausapiserver.js"
  2. Send PATCH request to http://localhost:3412/v2.0/translation/fb25dc8c-fa61-456c-ba0b-14675e049aae/source

No request headers

Request body: "Ich will stattdessen diesen Text übersetzt haben".

text/plain encoding

Result: HTTP 404 return code Error: Cannot PATCH /v2.0/translation/fb25dc8c-fa61-456c-ba0b-14675e049aae/source

heartsomeXPhantom commented 9 years ago

Test, works for me. I have added one additional return for error cases which was missing.

achimr commented 9 years ago

PATCH still doesn't work for me. I get a 404 HTTP return code.

heartsomeXPhantom commented 9 years ago

You cannot supply a simple plain text request (text/plain encoding), it must be formatted json, as an example (which works for me), it requires the attribute to be changed too. So the 404 is ok.: Content-type: application/json { "translationRequest": { "source": "Ich will stattdessen diesen Text übersetzt haben" } } Result: { "translationRequest": { "id": "39dff4cf-237f-4432-8f3a-95cc6d283111", "sourceLanguage": "de-DE", "targetLanguage": "en-US", "source": "Ich will stattdessen diesen Text übersetzt haben", "target": null, "mt": false, "crowd": false, "professional": false, "postedit": false, "comment": "We need a fast translation", "translator": "", "owner": "TAUS", "creationDatetime": "2014-05-20T19:20:00Z", "status": "initial", "modificationDatetime": "Wed, 12 Nov 2014 06:47:31 GMT", "updateCounter": 1 } }

achimr commented 9 years ago

My bad. It is pretty clear in the spec that the format needs to be JSON for non-file/url requests.