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

How can I delete a process group using the API?

Contributor

I am wanting to delete a process group from NiFi by using a curl command to the API. I tried using the following command.

curl -k -X DELETE -H "Authorization: Bearer $token" $cluster_url/nifi-api/process-groups/$process_group_uuid

But I get the error that the revision must be specified. When I delete a process group using the UI, I can see using Chrome dev tools that both a revision and client ID are specified. How can I get these values so I can use curl to delete the process group?

1 ACCEPTED SOLUTION

Accepted Solutions

Super Guru
@Josh Nicholson

To get ClientID and revision number of the processor group make GET RestAPI call for Process group.

curl -X GET http://<url>/nifi-api/flow/process-groups/<process-groupid>;

This Get method results you the clientid and revision number of the process group so when we are deleting particular process group then we need to pass these values in to the delete rest api call

curl -X DELETE '<url>/nifi-api/process-groups/<process-groupid>?version=<version_number>&clientId=<clientid>'

Example:

i have a process group with id 5eb0e7db-0165-1000-e40b-62a0bae27474 to get clientid and version details:

$ curl -X GET http://localhost:8081/nifi-api/flow/process-groups/5eb0e7db-0165-1000-e40b-62a0bae27474
[{"revision":{"clientId":"5ea367bc-0165-1000-74ab-d0e36167547e","version":1},"id":"5eb10684-0165-1000-fee6-01cbff4570a6","uri":"http://localhost:8081/nifi-api/output-ports/5eb10684-0165-1000-fee6-01cbff4570a6"}

As you can see my version is 1 so in my Delete call i'm using same client id and version number

curl -X DELETE 'http://localhost:8081/nifi-api/process-groups/5eb0e7db-0165-1000-e40b-62a0bae27474?version=2&clientId=5ea367bc-0165-1000-74ab-d0e36167547e'

Then the process group will be deleted.

if you are creating a shell script then you need to extract the clientid and version store it in a variable and pass those variables in your Delete call, so that you can automate your job using shell script.

View solution in original post

3 REPLIES 3

Super Guru
@Josh Nicholson

To get ClientID and revision number of the processor group make GET RestAPI call for Process group.

curl -X GET http://<url>/nifi-api/flow/process-groups/<process-groupid>;

This Get method results you the clientid and revision number of the process group so when we are deleting particular process group then we need to pass these values in to the delete rest api call

curl -X DELETE '<url>/nifi-api/process-groups/<process-groupid>?version=<version_number>&clientId=<clientid>'

Example:

i have a process group with id 5eb0e7db-0165-1000-e40b-62a0bae27474 to get clientid and version details:

$ curl -X GET http://localhost:8081/nifi-api/flow/process-groups/5eb0e7db-0165-1000-e40b-62a0bae27474
[{"revision":{"clientId":"5ea367bc-0165-1000-74ab-d0e36167547e","version":1},"id":"5eb10684-0165-1000-fee6-01cbff4570a6","uri":"http://localhost:8081/nifi-api/output-ports/5eb10684-0165-1000-fee6-01cbff4570a6"}

As you can see my version is 1 so in my Delete call i'm using same client id and version number

curl -X DELETE 'http://localhost:8081/nifi-api/process-groups/5eb0e7db-0165-1000-e40b-62a0bae27474?version=2&clientId=5ea367bc-0165-1000-74ab-d0e36167547e'

Then the process group will be deleted.

if you are creating a shell script then you need to extract the clientid and version store it in a variable and pass those variables in your Delete call, so that you can automate your job using shell script.

View solution in original post

Contributor

This worked, thanks!

Very nice and interesting
https://www.welookups.com