Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Post HTTP Attributes to Send as HTTP Headers (Regex)

avatar

Hi, Im using Apache Nifi , and I'm trying to send an HTTP POST request to my server API, my API needs a custom header in the HTTP Headers part like the following :

API-KEY : secret-key

How can I add this custome header in my POSTHTTP processor ?

1 ACCEPTED SOLUTION

avatar
Guru

If you use InvokeHTTP (with HTTP Method property set to PUT), the property Attributes to Send will send attributes as headers in the HTTP request. (You may have to use UpdateAttribute processor to set the attributes).

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.InvokeHTTP/

If this is what you are looking for, let me know by accepting the answer; else, let me know of any gaps or follow-up questions.

View solution in original post

3 REPLIES 3

avatar
Guru

If you use InvokeHTTP (with HTTP Method property set to PUT), the property Attributes to Send will send attributes as headers in the HTTP request. (You may have to use UpdateAttribute processor to set the attributes).

https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi.processors.standard.InvokeHTTP/

If this is what you are looking for, let me know by accepting the answer; else, let me know of any gaps or follow-up questions.

avatar
New Contributor
@Greg Keys

How did you manage to implement this? I've tried with the invokeHTTP with POST, GET and PUT with update attributes as an input sending the value for Headers to the invokeHTTP but it doesnt appear to work, I have put a proxy inline and that also never sees the headers being sent? I am trying to access the alientvault API, their example is

curl https://otx.alienvault.com:443/api/v1/pulses/subscribed?page=1 -H "X-OTX-API-KEY: LONGKEYHASHGOESHERE"

Or am I over thinking this and there is an easy way using getHTTP?