Support Questions

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

How can find a nifi process group id by Nifi rest api

avatar
Explorer

I have a project that try to connect nifi-api and import-export templates programatically. I can upload and delete templates succesfully but when i tried to delete related connections and controller services i realise that i don't have target process group id.

I need make some belowed calls:

  • /process-groups/{id}/controller-services
  • /process-groups/{id}/connections
  • /flow/controller/controller-services
  • /process-groups/{id} (delete)

and some other calls.

I have just xml template at first and i dont know how i can find process group {id}.

Any idea please?

1 ACCEPTED SOLUTION

avatar
Guru
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
9 REPLIES 9

avatar
Guru

Hi @nzr ytmn

Is it not in the information returned when you call the root? Something along the lines of: http://127.0.0.1:19090/nifi-api/flow/process-groups/root/status?recursive=true

avatar
Explorer

@Sonu Sahi thanks for information, but still i am not sure how i can relate my template with process groups. I can use name of template file and compare with name of process group; but i am not sure this is good idea.

avatar
Explorer

This will work

https://localhost:8080/nifi-api/process-groups/root/process-groups

 

This will print all the groups found in the main canvas

avatar
Explorer

Use Case 1

How to get all the groups in the main canvas programmatically?

Answer:

url="https://localhost:8080/nifi-api/"

content_type="Content-Type: application/json"
curl -k "${url}${end_point}" -H "${content_type}" -H "${bearer}"
 
Use Case 2
How to get the groups after finding the root and it's child groups ?
For example
From the Root --> Karthik Playground ==> Csv_2_Kafka,  JSON_2_KAFKA
Karthik Playground consists of 2 process group csv_2_kafka and json_2_kafka
Root. (uuid "aaaa-bbbb"
    ==> Karthik Playground.  (uuid "cccc-dddd")
       ==> csv_2_kafka.  (uid "eeee-fff")
       ==> json_2_kafka.  (uid "gggg-hhhh")
 
  From the use case 1, we get all the UUid under Component for all the process groups in root.
  Get the uuid for karthik playground and pass like this
 

url="https://localhost:8080/nifi-api/"

content_type="Content-Type: application/json"
curl -k "${url}${end_point}" -H "${content_type}" -H "${bearer}"
 This will fetch csv_2_kafka and json_2_kafka
 
Do the same process to get the information from csv_2_kafka and json_2_kafka
 

avatar
Explorer

Is there a single rest api call to get all process groups across all canvases?

avatar
Explorer

avatar
New Contributor

process-group-id.png

When you select a processor group, the "Operate Palette" is populated with the process-group id. I've highlighted the location in the attached png.

,

process-group-id.png

When you clickon a process-group, the "Operate Palette" will populate the process-group id. I've highlighted it in the attached png.

avatar
Explorer

@khadijah celestine i mean find a process group id of a template programmatically with nifi api requests.

avatar
Guru
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login