Support Questions

Find answers, ask questions, and share your expertise

Can I get variables on Flow in REST API?

avatar
Explorer

Hello, I have a question.

I hope to get variables data on NiFi Flow in REST API.

But, I found processor group variables data, not found flow's variables data api.

How do I do it?

Thank you

1 ACCEPTED SOLUTION

avatar

Hi @Seongmin Park
The "NiFi Flow" itself is also a process group, see on the left hand side when you log in, note the Process group ID that belongs to my NiFi Flow. I will also set a var on the NiFi Flow and retrieve it with REST:

85487-screen-shot-2018-08-02-at-103432.png

Setting a random var on it;

85488-screen-shot-2018-08-02-at-101255.png

And getting the variable data of the NiFi Flow over REST:

[root@c3175-node4 ~]# curl -i -X GET http://172.25.35.14:9090/nifi-api/process-groups/dadadbcd-0164-1000-16c1-6c50ce94361e/variable-regis...
HTTP/1.1 200 OK
Date: Thu, 02 Aug 2018 09:34:52 GMT
Content-Type: application/json
Content-Length: 362

{"processGroupRevision":{"clientId":"f9e30047-0164-1000-e3ba-51b6ec77ae6f","version":3},"variableRegistry":{"variables":[{"variable":{"name":"FlowVarExample","value":"This is a flow variable example : - )","processGroupId":"dadadbcd-0164-1000-16c1-6c50ce94361e","affectedComponents":[]},"canWrite":true}],"processGroupId":"dadadbcd-0164-1000-16c1-6c50ce94361e"}}

View solution in original post

1 REPLY 1

avatar

Hi @Seongmin Park
The "NiFi Flow" itself is also a process group, see on the left hand side when you log in, note the Process group ID that belongs to my NiFi Flow. I will also set a var on the NiFi Flow and retrieve it with REST:

85487-screen-shot-2018-08-02-at-103432.png

Setting a random var on it;

85488-screen-shot-2018-08-02-at-101255.png

And getting the variable data of the NiFi Flow over REST:

[root@c3175-node4 ~]# curl -i -X GET http://172.25.35.14:9090/nifi-api/process-groups/dadadbcd-0164-1000-16c1-6c50ce94361e/variable-regis...
HTTP/1.1 200 OK
Date: Thu, 02 Aug 2018 09:34:52 GMT
Content-Type: application/json
Content-Length: 362

{"processGroupRevision":{"clientId":"f9e30047-0164-1000-e3ba-51b6ec77ae6f","version":3},"variableRegistry":{"variables":[{"variable":{"name":"FlowVarExample","value":"This is a flow variable example : - )","processGroupId":"dadadbcd-0164-1000-16c1-6c50ce94361e","affectedComponents":[]},"canWrite":true}],"processGroupId":"dadadbcd-0164-1000-16c1-6c50ce94361e"}}