Support Questions
Find answers, ask questions, and share your expertise

Using NiFi to acquire auth token and call API with it

Hi everyone, 


I am trying to build a flow, that:

  • Gets a Bearer token using an API call, store it either in a variable or in a file
  • Read a CSV files with a list of parameter values
  • Call another API method using the parameter values (one call per parameter) and the token generated

I found some hurdles in order to do that:

  • I know there are processor group variables, but it seems I can only set them manually and not programmatically. 
  • If I put the valid tokens in a file I don't know exactly how to combine it with the list of parameters

What I try to achieve is the Cartesian product of parameters and token.

I figured out a flow using Wait and Notify processors but at the end I am little bit lost.


Some other challenges:

  • If the token becomes invalid, generate a new token and call the API again with the same parameters before the next 5 minutes schedule
  • How to merge the flowfile with the token more than one time

Any ideas if there is a not too nasty way to accomplish that.

Any comments will be highly appreciated.