Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

List existing Nifi templates using REST API

avatar
New Contributor

Hello,

I am trying to write a python script to upload and instantiate templates in Nifi 1.3 using rest API.

I am able to upload the template using upload API /nifi-api/process-groups/root/templates/upload.

But I don't see a way to list all existing templates so that I can update or delete/reload templates that are already upload. I see some references to API GET /nifi-api/controller/templates in forums, but that doesn't work any more on Nifi 1.3.

Any suggestions on the write set of API calls to find and update existing Nifi templates are appreciated.

Thanks

Gopal

1 ACCEPTED SOLUTION

avatar
Rising Star

Hi,

Use This

- this lists the resources in the server and formats the templates ids into a api call.

note: jq -- formats the output to be readable

curl -v -X GET http://NiFiServerIP:Port/nifi-api/resources | jq '.' | grep '"/templates/' | awk '{print $2}' | sed 's/\"//g'| sed 's/\/templates//g' | awk '{print "curl -v -X GET http://NiFiServerIP:Port/nifi-api/templates"$1"/download"}'

The output should be a Rest Api call:

curl -v -X GET http://NiFiServerIP:Port/nifi-api/templates/885dc02e-cb13-429c-bdvd-9a4e0cbe1212b/download

In the future if you don`t see how is done in the docs you can always SPY on the nifi-app.log, it gives you what you need to know.

Hope this helped.

View solution in original post

2 REPLIES 2

avatar
Rising Star

Hi,

Use This

- this lists the resources in the server and formats the templates ids into a api call.

note: jq -- formats the output to be readable

curl -v -X GET http://NiFiServerIP:Port/nifi-api/resources | jq '.' | grep '"/templates/' | awk '{print $2}' | sed 's/\"//g'| sed 's/\/templates//g' | awk '{print "curl -v -X GET http://NiFiServerIP:Port/nifi-api/templates"$1"/download"}'

The output should be a Rest Api call:

curl -v -X GET http://NiFiServerIP:Port/nifi-api/templates/885dc02e-cb13-429c-bdvd-9a4e0cbe1212b/download

In the future if you don`t see how is done in the docs you can always SPY on the nifi-app.log, it gives you what you need to know.

Hope this helped.

avatar
New Contributor

That works perfectly! Thanks!