简体   繁体   中英

NiFi: Which processor would I use to connect to a third party API requiring 3 credential elements?

The options for configuring the GetHTTP processor look like they would work for connecting to a third party API. I need to send the username (available), password (available) and a 3rd string value which represents the database name. When the response (json) comes back, it will contain a session identifier which I will later need for any other API (javascript) calls. There is a "new property" option for this processor which I thought I might be able to use for the database string, however, it appears to be looking for a specific type of property. The warning message I get states: 'database' validated against 'mydatabasename' is invalid because 'database' is not a supported property. Any advice? Also, once the response does return, how would I retain the session id from it for all the subsequent API calls?

GetHTTP accepts dynamic properties which will be passed as HTTP request headers to the server. I did not have any problem adding a dynamic property called database in NiFi 1.2.0, but I believe that is a relatively recent addition that might not be available in earlier versions. InvokeHTTP might be an alternative.

Reusing the session id requires parsing the session id out of the response and into a NiFi flowfile attribute. Depending on the type of content you get back, this is typically done with an ExtractText, EvaluateJsonPath, or a similar processor.

Subsequent GetHTTP or InvokeHTTP processors should be configured to have a dynamic property for the session id, with the value set to use NiFi expression language to use the flowfile attribute, like ${sessionid} .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM