Hi everybody. I am kind of become desperate on a task which seems quite easy at the first glace.
I want to call a webservice which is hosted on the same machine to analyze photos for faces etc.
The service is provided / started by a python script (which I have) and has very limited parameters etc. I also have a example how to call this services so everything seems to be straight forward.
Main challenge I have, is how to call the service with post method and handover a image (file). As the readme gives an example how to call the service using curl, I tried this and succeeded and I also succeed using postman. But I am failing using the "network / http request" node. I did also read a lot of posts and example but I always get the error message: "400 Bad Request Bad Request Missing file parameter!"
Curl example:
curl -X POST -F "file=@person1.jpg" http://localhost:8080/
What I have:
- I have the image in a buffer
What I tried:
- add the buffer to a variable image in the msg.payload -> failed
- add the buffer to a variable image in the msg.payload.images array -> failed
- add the buffer to a variable content in the msg.payload.images array in element 0 with fieldName=image content = buffer
- ...
I believe I tried all combination which could be right but for me it looks like, that the approach with payload does not work because if a call with curl my own service in node red simulation the real service, the image is provided in a "req" object "files" array and the object inside has fieldname : "file" and a buffer variable
Finally I found this topic ...
... but the linked "solution" looks quite a hack to me.
Any other solutions out there?
Thanks