apache-flinkapache-nififlink-streamingapache-nifi-registry

NIFI fetching data from API with help of given conditions


I was trying to fetch the data from a rest API inside NIFI, I have the following scenarios.
1) I have Rest API which fills fetch data from Cassandra database with the given parameters example employee number.
2) NIFI input port will receive this employee number from Flink application.
How do I fetch data from the rest api with the given employee number received in the input port? I don't need a scheduling mechanism here, just need to fetch data from Rest API whenever a filter input received in the input port, is this possible using NIFI?


Solution

  • Look over the http processors already built in on NiFi.

    You can use the InvokeHttp in order to query an external Rest Api, use the employee number that has been registered in the flowfile in the input port beforehand:

    https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.5.0/org.apache.nifi.processors.standard.InvokeHTTP/