Support Questions
Find answers, ask questions, and share your expertise

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

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

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

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.

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