Wednesday 3 August 2016

Starting and stopping NiFi jobs from Unix

Hello All,

Below is some info regarding the execution of NiFi flow/process group from Unix using Curl.

Find the processor ID and the group id i.e UUID from the NiFi User interface.
Use below URL in browser to find the process group ID and the related parent ID. Also, collect the version#

http://<hostname>:8080/nifi-api/controller/process-groups/root?verbose=true

hostname - generally it is localhost or any other specific URL provided by your organization.

only version number can be obtained with below command.
curl --request GET http://<hostname>:8080/nifi-api/controller/revision/

To Start a Process group:

curl -i -X PUT -H 'Content-Type: application/json' -d '{"revision":{"version":"<version#>"},"processGroup":{"id":"<ProcessGroupID>","parentGroupId":"<ParentID>","running":"true"}}' http://<hostname>:8080/nifi-api/controller/process-groups/<ProcessGroupID>/

To Stop a Process group, change the value for running to false






 A good reference for Shell scripting  https://linuxcommand.org/lc3_writing_shell_scripts.php