Hi! I’m using Docker version of n8n (0.166.0 release) and trying to understand the DeepL API documentation.
At the moment I see that n8n DeepL node only supports raw text translations. Since I need to send over the file, I see that a custom HTTP request is needed. Could you please help me with configuring POST multipart/form-data request?
POST /v2/document HTTP/1.0
Host: api-free.deepl.com
User-Agent: YourApp
Accept: */*
Content-Length: [length]
Content-Type: multipart/form-data;boundary="boundary"
--boundary
Content-Disposition: form-data; name="file"; filename="mydoc.docx"
contents of your uploaded document
--boundary
Content-Disposition: form-data; name="auth_key"
<my-auth-key>
--boundary
Content-Disposition: form-data; name="target_lang"
DE
--boundary--
What I already configured in the HTTP Request Node: Authentication: None (Auth key should be provided below) Request Method: POST request URL: https://api-free.deepl.com/v2/document
Next, where does Accept / Content-Length / Content-Type go?
I found the “Body Content Type” option which can be set to “Form-Data Multipart”. But what’s next?
how the Content-Type: multipart/form-data; boundary=“boundary” part should be set?
where does all these --boundary items go? Is it a header option?
finally, how the raw data should be transmitted? I see that “Send Binary Data” can be switched on and the Binary Property = data is activated by default. I made sure that the previous GET HTTP request returns a binary object with the Binary Property = data. So I assume I have the valid document, but I don’t understand how to pass it into “contents of your uploaded document” section?
I just checked the API docs, and you need to send multiple properties using the multipart content type. The HTTP currently only can send one multipart property. This issue is going to be addressed in the HTTP node V2. In the meantime, you can require the request library in the function node and make the call from there. Also, you can make a feature request here in the community asking for the missing functionality.
Thanks a lot.
I have finally completed this task in a bit different way.
I’ve added a custom Dockerfile that installs curl. Then I didn’t immediately built the image and rather updated my docker-compose to use a custom build: