Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Can I start a processgroup using rest-api

Solved Go to solution
Highlighted

Can I start a processgroup using rest-api

Expert Contributor

Hi,

I am able to start/stop processors using rest-api, can we do the same to process groups? The GET api doesn't show any status tag. What is the JSON we can POST to start/stop it?

Thanks,

Avijeet

{ "revision": { "version": 0 }, "id": "8619c3f4-0158-1000-a750-24884f23ea60", "uri": "http://localhsot:8080/nifi-api/process-groups/8619c3f4-0158-1000-a750-24884f23ea60", "position": { "x": 0, "y": 0 }, "permissions": { "canRead": true, "canWrite": true }, "bulletins": [], "component": { "id": "8619c3f4-0158-1000-a750-24884f23ea60", "position": { "x": 0, "y": 0 }, "name": "NiFi Flow", "comments": "", "runningCount": 0, "stoppedCount": 7, "invalidCount": 0, "disabledCount": 0, "activeRemotePortCount": 0, "inactiveRemotePortCount": 0, "inputPortCount": 0, "outputPortCount": 0 }, "status": { "id": "8619c3f4-0158-1000-a750-24884f23ea60", "name": "NiFi Flow", "statsLastRefreshed": "06:00:52 UTC", "aggregateSnapshot": { "id": "8619c3f4-0158-1000-a750-24884f23ea60", "name": "NiFi Flow", "flowFilesIn": 0, "bytesIn": 0, "input": "0 (0 bytes)", "flowFilesQueued": 36, "bytesQueued": 1536, "queued": "36 (1.5 KB)", "queuedCount": "36", "queuedSize": "1.5 KB", "bytesRead": 296384, "read": "289.44 KB", "bytesWritten": 209649, "written": "204.74 KB", "flowFilesOut": 0, "bytesOut": 0, "output": "0 (0 bytes)", "flowFilesTransferred": 1519, "bytesTransferred": 592128, "transferred": "1,519 (578.25 KB)", "bytesReceived": 92325, "flowFilesReceived": 75, "received": "75 (90.16 KB)", "bytesSent": 0, "flowFilesSent": 0, "sent": "0 (0 bytes)", "activeThreadCount": 0 } }, "runningCount": 0, "stoppedCount": 7, "invalidCount": 0, "disabledCount": 0, "activeRemotePortCount": 0, "inactiveRemotePortCount": 0, "inputPortCount": 0, "outputPortCount": 0 }

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Can I start a processgroup using rest-api

Hi @Avijeet Dash

Yes, you can do the same to process groups. Please refer NiFi Rest Api PUT /flow/processor-groups/{id} endpoint.

You can start a process group by sending PUT request to the endpoint a JSON like this:

{"id":"cda85e6e-0158-1000-150a-cb88f801e860","state":"RUNNING"}

Hope this helps,

Koji

4 REPLIES 4

Re: Can I start a processgroup using rest-api

Hi @Avijeet Dash

Yes, you can do the same to process groups. Please refer NiFi Rest Api PUT /flow/processor-groups/{id} endpoint.

You can start a process group by sending PUT request to the endpoint a JSON like this:

{"id":"cda85e6e-0158-1000-150a-cb88f801e860","state":"RUNNING"}

Hope this helps,

Koji

Re: Can I start a processgroup using rest-api

Expert Contributor

@kkawamura

I tried this but got - Message body is malformed. Unable to map into expected format.

Also in GET resonse I don't see any "state" tag

Re: Can I start a processgroup using rest-api

@Avijeet Dash

I was able to start a process group with following cURL command:

curl -i -H 'Content-Type: application/json' -XPUT -d '{"id":"cdb54c9a-0158-1000-5566-c45ca9692f85","state":"RUNNING"}' localhost:8080/nifi-api/flow/process-groups/cdb54c9a-0158-1000-5566-c45ca9692f85

Is there any difference with your request? I think GET response doesn't contain 'state' element because a process group doesn't have its own state, just a container of child processors.

Re: Can I start a processgroup using rest-api

Expert Contributor

Hi, thanks it worked, I was using a URL like below...then noticed the 'flow', used it and worked fine.

localhost:8080/nifi-api/process-groups/cdb54c9a-0158-1000-5566-c45ca9692f85
Don't have an account?
Coming from Hortonworks? Activate your account here