Support Questions
Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

How to read request body from handleHttpRequest processor in Nifi

Hi,

I am trying to expose an url which accepts post requests, process the requests and send the response.

For that, I used HandleHttpRequest processor in nifi to expose the endpoint. I am able to do post request and see the HandleHttpRequest processor accepts the requests successfully. However, I am unable to figure out how read the body of the request. In the data province I see the file attached with request body as content in "application/x-www-form-urlencoded" format.

My requirement is I need to read the content from the post request and convert it to JSON.

Please help me how to read the body of the post request that HandleHttpRequest processed or if there is other way to implement the requirement.

Thanks,

Anil.

1 REPLY 1

Are you posting JSON or posting form data?

The HandleHttpRequest processor is simply reading the body of the incoming request and placing it in the content of the flow file. So you would need to POST JSON to the end-point, or come up with a way to convert form data to JSON in the flow, but I don't believe anything like that exists.