Support Questions

Find answers, ask questions, and share your expertise

Nifi:Issue in invokehttp processor with Autorization code

avatar
New Contributor

Hello Team,

I am very new to nifi and doing a POC, I am trying to invoke a get request to our rest api by providing Authorization as attribute to invokehttp processor and token as value to that . When I tried to execute I am getting below response
{"timestamp":"2020-08-31T10:26:52.828+0000","status":400,"error":"Bad Request","message":"Missing request header 'Authorization' for method parameter of type String","path":"/v1/category"}

As far as I know providing Authorization as key and tokenas value to invokehttp treats it as dynamic property and send this in header .
I have also tried setting authorization with updateAttribute before and invoking invokehttp which didnt work yet 

I am receiving a failure here not sure where I went wrong could you please help .

 


 I have tried executing rest api where auth token is not required and it is working fine .

properties that I set before invokehttp

 

invokehttp1.pnginvokehttp2.png

2 REPLIES 2

avatar
Expert Contributor

Hi @praneet ,

Can you add Authorization inside "Attributes to Send" property and tell me if you are still getting the error?

avatar
Super Guru

@praneet Adding the value to the processor (+) is a suitable method.  You just need to make sure you get the right string in that field.  It's blocked out, but appears not just the actual token but prepended with "Bearer".  Try just the token string.

 

One thing I like to do for any API, before I start to work on invokeHttp configuration, is to use Postman to help me identify all of the required settings to test connection to an API.  Once this is complete, I can definitively ensure that nifi invokeHttp is sending the same request.

 

 

If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post.  

 

Thanks,


Steven