Support Questions

Find answers, ask questions, and share your expertise
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Update NiFi processor property using api

New Contributor

I'm trying to update a property Kafka Brokers of a processor using curl command from a Linux server.


curl -ik -X PUT -H 'Content-Type: application/json' -H 'Authorization: Bearer'"'${BT}'" -d '"component":{"id":"da7f19e0-0177-1000-0000-0000351dce2c","config":{"properties":{"Kafka Brokers":"${MIL_KAFKA_KERB_BROKERS}"}}'



HTTP/1.1 405 Method Not Allowed
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31540000
Content-Length: 0
Server: Jetty(9.4.26.v20200117)




There are a few changes to you command you will need to make.  All configuration changes need to include the current revision.

You can get the current revision by first executing the following:

  curl 'https://<hostname>:<port>/nifi-api/processors/5964ef54-017e-1000-0000-0000219f4de1' \
  -H 'Authorization: Bearer <BT>' \
  --compressed \

Then to make a change you can then use:

curl 'https://<hostname>:<port>/nifi-api/processors/5964ef54-017e-1000-0000-0000219f4de1' \
  -X 'PUT' \
    -H 'Authorization: Bearer <BT>' \
  -H 'Content-Type: application/json' \
  -d '{"component":{"id":"5964ef54-017e-1000-0000-0000219f4de1","config":{"properties":{"bootstrap.servers":"${MIL_KAFKA_KERB_BROKERS}"}}},"revision":{"version":<revision number>}}' \
  -i \


Things to take careful note of:
1. The user friendly property names shown in processors on the NiFi UI may not always match with the actual property name being modified.  Above is a perfect example since the consume and publish Kafka processor displays "Kafka Brokers"; however the actual kafka property being set is "bootstrap.servers".

2. It might be safer to use --data-raw in stead of just -d since the content may have = and @ used in it.

3. Start with '{" instead of '" only.

4. Be carful when copying from a text editor as the ' and " may get altered/changed by the editor.

5. All changes require a correct revision number.  The first command I provided will return you the current revision for the component.  Then use that revision number as shown in above example when you PUT the change.

Making use of the "Developer tools" provided within your browser will make it easier when trying to troubleshoot NiFi rest-api requests.  Simply open developer tools, make change to property, click "apply" on the component and observer the call made in the Network tab of the developer tools.  In most developer tools you can right click on the call and select "Copy as curl".  Then paste that copied command in your editor of choice for review.  Keep in mind the what you copy will have some additional unnecessary headers.

If you found this response assisted with your query, please take a moment to login and click on "Accept as Solution" below this post.

Thank you,


Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.