Support Questions

Find answers, ask questions, and share your expertise

Automate the NIFI workflow from CLI

avatar
Contributor

I have a NIFI workflow running, how do I start and stop the workflow from the CLI. Is it possible to only start/stop one workflow from multiple workflows?

3 REPLIES 3

avatar
Expert Contributor

Hey @syntax_ ,

Here is the documentation on NIFI's toolkit CLI commands. It seems there are commands for "pg-stop" and "pg-start", which I believe will allow you to start/stop and manage specific flows inside your canvas by using their IDs.

 

Personally, I would recommend you use NIFI's REST API for automations rather than CLI commands.

 

Hope this helps 🙂

avatar
Contributor

Thank you for the help. But why is it better to use APIs over CLI commands. Can you give some insight on that?

avatar
Expert Contributor

A couple of reasons:

  1. At the base level, operations in the UI all use the REST API - if you use chrome's devtools and go to the networking tab, you can see the exact REST API route used for every click you do on the canvas. If you'd ever want to automate something you know you can manually do in the UI, using this trick you can perfectly replicate it with with RESTful calls.
  2. In the same vain, the REST API has far more routes/operations available. The CLI tools seems to have around ~70 operations, whilst the rest api seems to have over 200.
  3. The CLI commands are part of the nifi toolkit. Whilst the toolkit does get updated, I believe it does not get the same level of attention as nifi's main codebase and as such it'd be better not to rely on it completely.

This is not to say you can't use the CLI tool - rather, just my opinion on the matter and some insight for how my team writes automations on nifi 🙂