Support Questions

Find answers, ask questions, and share your expertise

Nifi InvokeHttp Content-Type with GET

avatar
Rising Star

The web service I'm calling requires the Content-Type header to be set to application/json, but it appears the InvokeHttp processor only sets this header if it is a POST or PUT request. Is there any way to set this header for GET requests?

1 ACCEPTED SOLUTION

avatar
Rising Star

Thanks for the answer. What you posted didn't work, but I did play with and eventually got it. What I had to do was have an UpdateAttribute processor before my InvokeHTTP that sets an attribute called "Content-Type", then in InvokeHTTP, set "attributes to send" to "Content-Type" and it worked.

Thanks!

View solution in original post

2 REPLIES 2

avatar
Rising Star
@Frank Maritato

Have you looked at adding a dynamic property? If you take a look here: https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.InvokeHTTP/

"Attributes to send" is where you will want this. So in your nifi processor it should look like the image attached, can you try that?

7504-screen-shot-2016-09-08-at-21656-pm.png

avatar
Rising Star

Thanks for the answer. What you posted didn't work, but I did play with and eventually got it. What I had to do was have an UpdateAttribute processor before my InvokeHTTP that sets an attribute called "Content-Type", then in InvokeHTTP, set "attributes to send" to "Content-Type" and it worked.

Thanks!