Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

How to get the UUID of a process group after creation using API?

avatar
Expert Contributor

I am writing a script that will dynamically create a process group with a given name based on user input. I then am wanting to deploy a template inside of this process group immediately after it gets created. Since NiFi generates the UUID for the new process group after the POST to the API, I am stumped on how to get the UUID of the newly created process group. How can I accomplish this so I can then deploy a template inside of it?

I tried generating a UUID myself for the process group in bash by using `uuidgen` so I could easily track this in a variable, however the POST fails for some reason when I send this along with the name.

Here is the curl that is failing when I provide a uuid I generated.

curl -k -X POST -v -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{"revision":{"clientID":"'$uuid'","version":0},"component":{"name":"'$CLUSTER_NAME' '$FLOW_NAME'"}}' https://myhost.com:9091/nifi-api/process-groups/$EXISTING_PROCESS_GROUP/process-groups/

If I remove the `clientID` part of the JSON, the POST works and NiFi generates a UUID for me, which results in my original problem.

1 ACCEPTED SOLUTION

avatar
Master Guru

The response of the POST should be the process group entity with the id populated, and in addition there should be a header that has the URI of the created process group.

View solution in original post

1 REPLY 1

avatar
Master Guru

The response of the POST should be the process group entity with the id populated, and in addition there should be a header that has the URI of the created process group.