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.

NiFi: Can I get variables with REST API on NiFI?

avatar
New Member

Hello,

Can I get 'variables' in NiFI on REST API?

I found to get variables in NiFi's rest api document, but not found.

variables is : picture.

is it provided?

1 ACCEPTED SOLUTION

avatar
Hi @Seongmin Park

Yes, this is possible with the REST API. For example, I made a process group with 1 variable "TestVariable" and content "Hello Seongmin"

85460-screen-shot-2018-08-01-at-093347.png

Now to get this using REST, I run;

curl -i -X GET http://172.25.36.20:9090/nifi-api/process-groups/<your group id here>/variable-registry

And the output from that rest query

HTTP/1.1 200 OK
Date: Wed, 01 Aug 2018 08:33:32 GMT
Content-Type: application/json
Content-Length: 337

{"processGroupRevision":{"clientId":"f49c73f5-0164-1000-48ef-ef1af0585eca","version":4},"variableRegistry":{"variables":[{"variable":{"name":"TestVariable","value":"Hello Seongmin","processGroupId":"f49c4d0a-0164-1000-ffff-ffffb54b15e2","affectedComponents":[]},"canWrite":true}],"processGroupId":"f49c4d0a-0164-1000-ffff-ffffb54b15e2"}}

View solution in original post

2 REPLIES 2

avatar
Hi @Seongmin Park

Yes, this is possible with the REST API. For example, I made a process group with 1 variable "TestVariable" and content "Hello Seongmin"

85460-screen-shot-2018-08-01-at-093347.png

Now to get this using REST, I run;

curl -i -X GET http://172.25.36.20:9090/nifi-api/process-groups/<your group id here>/variable-registry

And the output from that rest query

HTTP/1.1 200 OK
Date: Wed, 01 Aug 2018 08:33:32 GMT
Content-Type: application/json
Content-Length: 337

{"processGroupRevision":{"clientId":"f49c73f5-0164-1000-48ef-ef1af0585eca","version":4},"variableRegistry":{"variables":[{"variable":{"name":"TestVariable","value":"Hello Seongmin","processGroupId":"f49c4d0a-0164-1000-ffff-ffffb54b15e2","affectedComponents":[]},"canWrite":true}],"processGroupId":"f49c4d0a-0164-1000-ffff-ffffb54b15e2"}}

avatar
New Member

Thank you sir!