- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
List existing Nifi templates using REST API
- Labels:
-
Apache NiFi
Created on ‎11-02-2017 08:23 PM - edited ‎09-16-2022 05:29 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
Created ‎11-02-2017 10:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎11-02-2017 10:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Created ‎11-03-2017 02:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That works perfectly! Thanks!
