Support Questions

Find answers, ask questions, and share your expertise

Consume API with Nifi-Token authentication

avatar
Expert Contributor

I want to create a Nifi flow with GET requests to a REST API that supports authorization via a Bearer token, however i have problems to create the proper flow due to the several available HTTP-related processors in Nifi.

My question is which is the proper flow to do this?

I tried the flow GetHTTP --> Update Attribute --> PutHDFS to store also the results in HDFS after the filename is appended with a timestamp but i could not find a way to properly configure the GetHTTP processor for the token authorization.

The flow InvokeHTTP --> UpdateAttribute --> PutHDFS also didnt work for me, setting the Send Attributes =Authorization and adding the token as value to the newly created Authorization property fails with a "Yielding processor due to exception encountered as source processor" error. Any ideas on how could i proceed with this? Thanks in advance!

1 ACCEPTED SOLUTION

avatar
Expert Contributor

I found a way to create empty flowfiles, update the attributes with proper authorization headers and send the request with InvokeHTTP.

39782-api.png

View solution in original post

5 REPLIES 5

avatar
Expert Contributor

I found a way to create empty flowfiles, update the attributes with proper authorization headers and send the request with InvokeHTTP.

39782-api.png

avatar
New Contributor

This helps a lot. Can someone help me how to pass Bearer Authentication? How to pass it as header?

how to update the attributes with proper authorization headers and send the request with InvokeHTTP?

Thanks in advance.

avatar
Explorer

Hi, 

 

Can you share the template with us or the screenshot on which attribute (created or updated) and how it was added to the header of InvokeHTTP.

 

Please share , I am facing the same issue.

 

Thanks

Rupesh

avatar
Explorer

avatar
New Contributor

@balalaika Could you please share the template?

,

@balalaika Could you please share the template?

,

Can you please share the template?