Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on
10-11-2018
02:02 PM
- last edited on
04-21-2026
05:14 AM
by
GrazittiAPI
I have been trying to change the GetFile processor properties (Input Directory,keep resource file...etc) using rest api call but getting below response :
Command:
curl -i -X PUT -H 'Content-Type: application/json' -d '{"revision":{"version":3,"clientId":"5f10fbca-0166-1000-ae68-13829a991131"},"processor":{"id":"1ffcfa18-0165-1000-ffff-ffffa779f243","parentGroupId":"1fe8ebbf-0165-1000-0000-00003595dafd","config":{"properties":{"Input Directory":"/tmp/hortontest"}}}}' http://node1:9090/nifi-api/controller/process-groups/1fe8ebbf-0165-1000-0000-00003595dafd/processors...
Output:
HTTP/1.1 404 Not Found Date: Thu, 11 Oct 2018 13:48:40 GMT X-Frame-Options: SAMEORIGIN Content-Type: text/plain Vary: Accept-Encoding Content-Length: 42 Server: Jetty(9.4.3.v20170317) The specified resource could not be found.
Created 10-12-2018 06:40 AM
Yeah, that doesn't work because our format should be slightly different. Try this, I just tested and it works fine;
curl -i -X PUT -H 'Content-Type: application/json' http://<nifi-host>:9090/nifi-api/processors/6391462d-0166-1000-0000-000002b215e0 -d '{"revision":{"clientId":"63911e66-0166-1000-3f04-f0e4a96a47da","version":"4"},"component":{"id":"6391462d-0166-1000-0000-000002b215e0","config":{"properties":{"Input Directory":"/some/new/dir"}}}}'
PS. if you found my answers helpful, please click accept answer 🙂
Created 10-11-2018 03:12 PM
I've tried this myself just now, by first exporting the current settings like so;
curl -X GET -H 'Content-Type: application/json' http://nifibox:9090/nifi-api/processors/6391462d-0166-1000-0000-000002b215e0 | python -m json.tool > /tmp/processorconfig.json
And then from the resulting json output, I modify the directory listed and post it back like so;
curl -X PUT -H 'Content-Type: application/json' http://nifibox:9090/nifi-api/processors/6391462d-0166-1000-0000-000002b215e0 -d @processorconfig.json
BTW, specifying the processor ID alone on the PUT operation is enough - even if the processor is part of a different process group the above example still works.
Created 10-11-2018 03:44 PM
Thanks for quick response Jon. Is the only way I could do that or are any other ways I can modify the processor properties with rest api calls ?
Created 10-11-2018 03:59 PM
A few more examples are documented here; https://community.hortonworks.com/articles/87217/change-nifi-flow-using-rest-api-part-1.html
Otherwise, all the options we have should be listed here; https://nifi.apache.org/docs/nifi-docs/rest-api/index.html
Created 10-11-2018 04:47 PM
@Jonathan Sneep
https://community.hortonworks.com/articles/87217/change-nifi-flow-using-rest-api-part-1.html as per step 7 I used the below command :
curl -X PUT -H 'Content-Type: application/json' -d '{"component":{"id":"1ffd1b86-0165-1000-ffff-ffffe8f36d71","name":"GetFile","config":{"Input Directory":"/tmp/hortontest","Keep Source File":"false"},"revision":{"clientId":"5f10fbca-0166-1000-ae68-13829a991131","version":2}}' http://nifinode:9090/nifi-api/processors/1ffcfa18-0165-1000-ffff-ffffa779f243
Output:
Unrecognized field "Input Directory" (class org.apache.nifi.web.api.dto.ProcessorConfigDTO), not marked as ignorable (17 known properties: "yieldDuration", "descriptors", "runDurationMillis", "concurrentlySchedulableTaskCount", "schedulingStrategy", "autoTerminatedRelationships", "customUiUrl", "lossTolerant", "properties", "comments", "schedulingPeriod", "defaultConcurrentTasks", "annotationData", "executionNode", "penaltyDuration", "defaultSchedulingPeriod", "bulletinLevel"]) at [Source: (org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream); line: 1, column: 105] (through reference chain: org.apache.nifi.web.api.entity.ProcessorEntity["component"]->org.apache.nifi.web.api.dto.ProcessorDTO["config"]->org.apache.nifi.web.api.dto.ProcessorConfigDTO["Input Directory"])
Created 10-12-2018 06:40 AM
Yeah, that doesn't work because our format should be slightly different. Try this, I just tested and it works fine;
curl -i -X PUT -H 'Content-Type: application/json' http://<nifi-host>:9090/nifi-api/processors/6391462d-0166-1000-0000-000002b215e0 -d '{"revision":{"clientId":"63911e66-0166-1000-3f04-f0e4a96a47da","version":"4"},"component":{"id":"6391462d-0166-1000-0000-000002b215e0","config":{"properties":{"Input Directory":"/some/new/dir"}}}}'
PS. if you found my answers helpful, please click accept answer 🙂
Created 10-12-2018 01:57 PM