Support Questions

Find answers, ask questions, and share your expertise

Best way to alter a nifi processor configuration - use curl & API or python? Or something else?

avatar
Explorer

Hi

What is the preferred method to alter a nifi processor configuration please?

We want to be able to get a user to choose from one of 3 options from a drop down menu in a GUI screen. The chosen option then is passed to either a curl command to make changes to the processor via the Nifi API, or can we create a python command to then alter a nifi processor configuration possibly by curl, but maybe there is another way?

Curl looks a safer option, but python might be better? Not sure....?

Thanks in advance. 

3 REPLIES 3

avatar
Expert Contributor

Hello @zzzz77

The best way here should be the NiFi API. It's safer and more standardized. Also, since it's NiFi provided, it's easier to integrate. 
https://nifi.apache.org/docs/nifi-docs/rest-api/index.html

You can use the Processors options. 


Regards,
Andrés Fallas
--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs-up button.

avatar
Explorer

Hi,

Thanks, will do.

I did try reading Provenance data via the nifi 2.5.0 API and it seems to fail

I installed NIfi on my PC with no modifications and all default settings, and just use the default user and password that's created when you install it.

I run this in my local windows CMD window and get   "unknown error" :

curl --insecure -X POST -H "Authorization: Bearer <my token> " https://localhost:8443/nifi-api/provenance

Then I run this and get : 

curl --insecure -X POST -H "Authorization: Bearer <token>" https://localhost:8443/nifi-api/provenance > test.txt

In text.txt file I get :

"An unexpected error has occurred. Please check the logs for additional details."

I just wanted to check I have the syntax right.  I ran other API queries for flows etc and they work fine.

What I'm trying to do is get a list of all files that have passed through my small local nifi installation so we can track what files have moved through nifi and when, as a form of monitoring.

avatar
Expert Contributor

Hello @zzzz77

That happens because NiFi 2.x API does not work with an empty POST on for provenance, it always needs to consume a valid JSON: 

vafs_0-1764264769892.png
https://nifi.apache.org/docs/nifi-docs/rest-api/#provenance 

You need to add the query, something like this: 
curl --insecure -X POST -H "Authorization: Bearer <token>" -H "Content-Type: application/json" -d "{\"provenance\":{\"request\":{\"maxResults\":1000}}}" https://localhost:8443/nifi-api/provenance

Check in your environment. 


Regards,
Andrés Fallas
--
Was your question answered? Please take some time to click on "Accept as Solution" below this post.
If you find a reply useful, say thanks by clicking on the thumbs-up button.