Created 11-03-2016 01:54 PM
Background:We are using Apache NIFI data flow to move data local from to Hadoop based file systems.We are executing the NIFI processors by calling the NIFI rest API using groovy script wherein we use json builders in groovy to generate the Json and then passing the json to put methods to execute the processors. NIFI Version:0.6.0
While planning to migrate to NIFI 1.0.0 and using the same groovy script we are facing a few errors in the latest version of NIFI(1.0.0):
Since the syntax provided above works perfectly fine in 0.6.0 I would like to know if any changes are made in NIFI 1.0.0 in the rest API or in the way the various HTTP requests are passed to methods like 'get' and 'put'?
I could not find any changes in the release notes or the NIFI API documentation provided in the link below:
https://nifi.apache.org/docs/nifi-docs/rest-api/
Please let me know if you need any other information.
Regards,
Indranil Roy
Created 11-03-2016 02:10 PM
Indranil Roy,
For Apache NiFi 1.0.0 the REST API was completely refactored to promote multi-tenancy. Specifically, the endpoints have been reorganized to align with the resources being authorized and component specific revisions have been introduced. I would highly recommend using the Developer Tools in your browser to see the APIs in action. Here is an example curl commend for starting a processor.
curl 'http://localhost:8080/nifi-api/processors/2a817541-0158-1000-771e-93ca6d670429' -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' --data-binary '{"revision":{"clientId":"2a81087c-0158-1000-1362-5452a699615c","version":3},"component":{"id":"2a817541-0158-1000-771e-93ca6d670429","state":"RUNNING"}}'
In order to get the revision details for this component it would be available in the flow returned for a given process group. Here's an example of that curl commend.
curl 'http://localhost:8080/nifi-api/flow/process-groups/<process-group-id>'
Created 11-03-2016 02:10 PM
Indranil Roy,
For Apache NiFi 1.0.0 the REST API was completely refactored to promote multi-tenancy. Specifically, the endpoints have been reorganized to align with the resources being authorized and component specific revisions have been introduced. I would highly recommend using the Developer Tools in your browser to see the APIs in action. Here is an example curl commend for starting a processor.
curl 'http://localhost:8080/nifi-api/processors/2a817541-0158-1000-771e-93ca6d670429' -X PUT -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' --data-binary '{"revision":{"clientId":"2a81087c-0158-1000-1362-5452a699615c","version":3},"component":{"id":"2a817541-0158-1000-771e-93ca6d670429","state":"RUNNING"}}'
In order to get the revision details for this component it would be available in the flow returned for a given process group. Here's an example of that curl commend.
curl 'http://localhost:8080/nifi-api/flow/process-groups/<process-group-id>'
Created 12-21-2016 11:56 AM
thank you so much.. i had issues with this curl dude.. had been searching for the correct command for over 3 days.. its working now.. 😄
Created 12-21-2016 01:03 PM
where can I get this entire documentation? What if I want to run a Process-Group ?
Created 12-21-2016 09:00 PM
The documentation is the link that you already have. However, I would suggest checking out the Developer Tools in your browser. The UI uses the REST API for all interactions with the framework. The Developer Tools even allows for you to copy the command as a cUrl command.
Here's the command for starting a Process Group.
curl 'http://localhost:8080/nifi-api/flow/process-groups/232d4ab5-0159-1000-1962-8a2afbbe9dc9' -X PUT -H 'Accept-Encoding: gzip, deflate, sdch, br' -H 'Content-Type: application/json' -H 'Accept: application/json, text/javascript, */*; q=0.01' -H 'Referer: http://localhost:8080/nifi/' -H 'X-Requested-With: XMLHttpRequest' -H 'Connection: keep-alive' --data-binary '{"id":"232d4ab5-0159-1000-1962-8a2afbbe9dc9","state":"RUNNING"}' --compressed
Created 12-22-2016 01:36 PM
thank you so so much.. i can enjoy holidays now knowing this has been taken care of.. Happy Holidays to you 🙂 will surely research on Dev Tools
Created 06-07-2017 08:35 AM
the above command works as a curl perfectly. can we achieve the same from the nifi processors? I am trying with InvokeHTTP and POSTHTTP but where do we need to specify the data-binary values in the processors?