Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Post HTTP Attributes to Send as HTTP Headers (Regex)

Solved Go to solution
Highlighted

Post HTTP Attributes to Send as HTTP Headers (Regex)

New Contributor

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

Accepted Solutions

Re: Post HTTP Attributes to Send as HTTP Headers (Regex)

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.

3 REPLIES 3

Re: Post HTTP Attributes to Send as HTTP Headers (Regex)

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.

Re: Post HTTP Attributes to Send as HTTP Headers (Regex)

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?

Re: Post HTTP Attributes to Send as HTTP Headers (Regex)

Super Guru