How do I send a translation request as a POST request?
In a POST request, you do not send the data in the URL, but rather as data in the body of the request. There exist libraries for most programming languages to support the easy sending of POST requests.
However, if you have to create a POST request yourself, you should consider the following points:
- Use POST as the request method.
- Set the Content-Type request header to application/x-www-form-urlencoded.
- Set the Content-Length request header to the number of bytes in the request body.
- Insert your translation request parameters into the request body. The parameters should be URL-encoded using the UTF-8 character set. In other words, the body looks exactly like the query part of the equivalent GET-request (the characters after the question mark of a GET-request).
- Use the same URL as for GET-requests, but without parameters, i.e. https://api.deepl.com/v2/translate.
The request https://api.deepl.com/v2/translate?auth_key=00000000-0000-0000-0000-000000000000&text=This%20is%20a%20Test.&target_lang=EN should look like this as a POST request:
POST /v2/translate HTTP/1.1