Reputation: 70466
The following flow takes a username/password combination and authenticates against an API via InvokeHTTP:
The result of InvokeHTTP is an authentication token:
I want to use this token in any preceding API calls. What flow do I need to provide the auth token as an authorization header for InvokeHTTP? The header has to look like this:
Authorization: Token ...
Upvotes: 4
Views: 2024
Reputation: 14194
You can use an EvaluateJsonPath
processor to extract a JSON value using the JsonPath expression $.token
and Destination flowfile-attribute
, which will place it in an attribute. So using a dynamic property named Authorization with the value $.token
will result in InvokeHTTP
sending a header with the value Authorization: abcdef....
. In order to format the header correctly, you'll want to use an UpdateAttribute
processor between EvaluateJsonPath
and InvokeHTTP
to update the attribute value using the Expression Language expression Token ${Authorization}
to prepend the literal string.
Upvotes: 6