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.

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

Solved Go to solution

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

Explorer

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

Accepted Solutions

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

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"}}
2 REPLIES 2

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

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"}}
Highlighted

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

Explorer

Thank you sir!

Don't have an account?
Coming from Hortonworks? Activate your account here