I’m trying to send an image in binary to Wordpress without the built-in module because I have many websites that I want to map the base_url, user, password, etc.
I have a service that gives me links to images, I’m using HTTP Get a File to download the binary, and although now I can use the built in Wordpress module with success mapping the file I can’t get it to work with the HTTP Make a Request module. The binary file isn’t being sent I see a “[Buffer]” in Make Dev Tools instead.
First image shows the output when using the “Data” parameter from the Get a File module. Second shows the output when mapping the the same “Data” parameter using the built-in Wordpress Add Media module.
How can I get it to work with the HTTP Make a Request? Tried toString() without luck.
Hello @Santi_Leoni and welcome to the Make Community!
For this, you could try using a Create JSON module prior to HTTP.
The result of Create JSON can be passed as the Request content in the HTTP module.
In Create JSON, you can add your fields (file, file.value, file.options, file.options.filename, etc…) then for file.value, set the field type to Binary Data.
Make should then take care of encoding the entire object into JSON for you.
2 Likes
Thanks for the insight man. I know I did a step in the right direction. But after sending the supposedly same request using the module or the HTTP Make a request. I receive a “No data supplied” error when using the custom method.
See how the body of each request differs. Using Make’s built-in module:
Using HTTP Make a Request:
Here’s the output of the Create JSON prettier:
Both requests have the same parameters except for the value that one has the mapped that shows that “IMTBuffer(114769, binary, 65931…”
GOT IT TO WORK
After countless hours here’s the meat. Impossible to send binary files as text using the “Raw” Body Type. Need to use “Multipart/form-data”. See image below:
4 Likes