Support Questions

Find answers, ask questions, and share your expertise

NiFi HTTP, unable to format post put request correctly

New Contributor

I need to send an HTTP POST or PUT request. The request provides a 1 line json response when sent correctly. I want to capture the response and send it as a get request. I can use this curl command to successfully send the request:

curl -F file=@/somepath/somefilename

I tried various scenarios with InvokeHttp and HttpPost, but the response comes back as either a 400 BAD REQUEST or 500 SERVER ERROR.

Here is the request I tried last from the app log file.

2018-02-27 15:06:00,536 DEBUG [Timer-Driven Process Thread-1] o.a.nifi.processors.standard.InvokeHTTP InvokeHTTP[id=d25f484f-0161-1000-d92d-c1fe227a25a3] Request to remote service: date: Tue, 27 Feb 2018 20:06:00 GMT file: =@"/opt/nifi-1.5.0/testfiles/CyberAwarenessChallengeCertificate.pdf"

This request produced a 400 response.


@Regis Thomas

It might not be ideal from a performance perspective, but you could use ExecuteProcess to run a shell script or python script makes the call. I know it doesn't directly address the issue with the processors in question but it might be a viable work around.

New Contributor

@Michael Young

Thanks! I was able to get it to work with ExecuteStreamCommand, I was just hoping there would be a way to do it through InvokeHttp.