Reputation: 320
I would like to set some properties before my InvokeHTTP
processor in NiFi. In fact, I try to use an API and I would like to give HTTP headers with key API.
I can set all properties with a lot of UpdadeAttribute
but there is two problems :
UpdadeAttribute
These properties are in assembly of two keys.
First, I merge the two keys in merged_keys
${api_key}:${api_secret_key}
Second, I encode merged_keys
in encoded64_key
.
${merged_key:base64Encode()}
Then, I write my HTTP header Authorization
using encoded64_key
'Authorization': 'Basic ${encoded64_key}'
edit : I tried to set this configuration in UpdateAttribute
but I know that isn't a good way so I tried to set it directly in my InvokeHTTP
and nothing happen.
The part of building HTTP header works perfectly but I don't know how can I do for give this header to my InvokeHTTP
one time.
Upvotes: 0
Views: 2136
Reputation: 13541
Set a property on the InvokeHTTP processor with name Authorization
and value Based ${encoded64_key}
. This is the way to attach the header. See the documentatinos.
An HTTP client processor which can interact with a configurable HTTP Endpoint. The destination URL and HTTP Method are configurable. FlowFile attributes are converted to HTTP headers and the FlowFile contents are included as the body of the request (if the HTTP Method is PUT, POST or PATCH).
FYI with the contents, you should give the contents as a flowfile by using replaceText processor.
Upvotes: 2