Support Questions

Find answers, ask questions, and share your expertise

How to authenticate NiFi processor on SFDC REST API calls

avatar
Expert Contributor

We used the InvokeHTTP processor in NiFi on Salesforce REST API (POST action, to effect changes in customer data). Salesforce requires authentication in using of its REST endpoints. Is the InvokeHTTP the right processor for this requirement? How do we maintain authenticated connection / session to REST API?

1 ACCEPTED SOLUTION

avatar
Master Guru

According to this, Salesforce requires authentication via OAuth 2.0. Please see this HCC article for a discussion (and related links) on how to achieve this. The question is about the GetHttp processor but should apply to InvokeHttp as well.

View solution in original post

4 REPLIES 4

avatar
Master Guru

According to this, Salesforce requires authentication via OAuth 2.0. Please see this HCC article for a discussion (and related links) on how to achieve this. The question is about the GetHttp processor but should apply to InvokeHttp as well.

avatar
Expert Contributor

Thanks for the tip Matt. I am now in the part where I have two InvokeHTTP processors, the first for login or getting the access token (let's call this SFDCLogin), and the second is where the SFDC REST API is configured for posting changes to SalesForce's ObjectStore (let's call this SFDCUpdate). I having a hard time doing the plumbing on this. The idea is, the FlowFiles (wherever they come from, assuming its GetFile processor) would move to SFDCUpdate and then if rebuffed due to missing or expired access token, will go to SFDCLogin processor and do whatever it needs to do and then go to SFDCUpdate. Note that I only need to pass through SFDCLogin once, once authenticated; not multiple times. Any custom logic, attribute, property, or expression language to make this work?

I also tried using the ExecuteScript processor using ECMAScript or Python, and do the REST API calls there on the login part. However, I'm hitting a roadblock on XMLHttpRequest (in ECMAScript) or requests (in Python) as it seems I need to point to their libraries. Should I be using a Java library (jar of HttpComponents perhaps) instead as these scripting languages are meant to wrappers only? Or can I point to their respective libraries natively?

avatar
Explorer

Hi, 

 

Its been a long time now. Not sure, you are still on track with NiFi. Just to know how do you achieve this. Can you share some insights? 

avatar

Hi @Kart

 

As this is a thread which was marked 'Solved' over three years ago, you would have a better chance of receiving a resolution by posting a new question. This will also present you with the opportunity to include details specific to your environment that could aid other members in providing a more relevant answer to your question.

 

 

Bill Brooks, Community Moderator
Was your question answered? Make sure to mark the answer as the accepted solution.
If you find a reply useful, say thanks by clicking on the thumbs up button.