I am trying to automate the Deployment of nifi flow. We searched and found a link (given below)
It contains the Groovy code. But we are looking out for REST API in Java.
The link also says that, REST APIs and concepts have changed significantly from NiFi 0.x to NiFi 1.x (It is explained for NiFi 0.x in the link)
Since we are using NiFi 1.3.0, I thought it would be the best to ask for help.
You might be interested by https://github.com/Chaffelson/nipyapi (if you want a python wrapper for the full NiFi API)
Also note that there is on-going work around the sub-probect NiFi Registry (https://nifi.apache.org/registry.html) to ease the deployment of workflows between environments.
You can use Nifi-Toolkit which provides CLI to interact with NIFI instance and NIFI Registry instance.
A Powershell script can than be written to automate the whole deployment process.
You need to register registry clients to you Nifi instance. Once you create the appropriate buckets per your environment in your registry instance and connect this instance to your Nifi flows, you can use Nifi toolkit which provides commands to export flow from one environment and import it to other via registry buckets.
e.g. run the following command from the Cli.sh or cli.bat which is found in nifi-toolkit code base.
registry export-flow-version -f $fromFlowidentifier -fv $flowversion -o temp-flow.json -ot json -u $registrylink ;
here fromflowidentifier is the flow identifier that is found in your registry bucket. temp.json is the file where it will export the flow. Once exported you can import the flow using bellow command.
registry import-flow-version -f $toflowidentifier -i temp-flow.json -u $registrylink ;
Here it is assumed you have linked the nifi instances with the buckets in registryclient .
Here is my sample autodeployment powershell script to import nifi flow: It will not only deploy the flow but will also set the flow variables. If deployment fails for some reason it will also send an email. This assume you are using Nifi-registry and have installed Nifi-toolkit. Please go through the readme and script is also commented for proper understanding.
GitHub Link: https://anp8729.github.io/Nifi_AutoDeploymentScript/