Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

List existing Nifi templates using REST API

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

Contributor

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

Contributor

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.

New Contributor

That works perfectly! Thanks!

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.