<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Re: Start/Stop a NiFi Processor via REST API: Desired State is not set in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374290#M241941</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/106070"&gt;@CommanderLaus&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;If you do anything manually with the processor you are trying to change its Running State through the API, then yes the revision will be updated. In my case what I do is basically the first API InvokeHttp is to get the latest revision using the following GET API:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://localhost:8443/nifi-api/processors/${pipeline.start.processor.id}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will give the following response where you can parse the latest "&lt;STRONG&gt;version&lt;/STRONG&gt;" value using something like EvaluateJsonPath processor and store the value in an attribute:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "revision": {
	    "clientId": "value",
	    "version": 0,
	    "lastModifier": "value"
	},
    "id": "value",
    "uri": "value",
    "position": {…},
    "permissions": {…},
    "bulletins": [{…}],
    "disconnectedNodeAcknowledged": true,
    "component": {…},
    "inputRequirement": "value",
    "status": {…},
    "operatePermissions": {…}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then use extracted version attribute to build the next API post Body , for example in my case I use ReplaceText processor to generate the post body :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "revision": {
	    "clientId": "${pipeline.start.processor.id}",
	    "version": ${processorVersion}
	   
	},
    "state": "...",
    "disconnectedNodeAcknowledged": true
	
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Jul 2023 14:49:14 GMT</pubDate>
    <dc:creator>SAMSAL</dc:creator>
    <dc:date>2023-07-21T14:49:14Z</dc:date>
    <item>
      <title>Start/Stop a NiFi Processor via REST API: Desired State is not set</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374286#M241937</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;I'm trying to use NiFis Rest API to start and stop a Processor, but evertime I get the response&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;The desired state is not set&lt;/PRE&gt;&lt;P&gt;Here is my curl-Command which I use:&lt;/P&gt;&lt;PRE&gt;curl -k --header "Authorization: Bearer $token" -i -H 'Content-Type: application/json' -XPUT -d'{ "revision": { "version": 18, "clientId": "01891026-da00-199f-9dc9-ae3a37dce067" }, "status": { "runStatus": "RUNNING" }, "component": { "id": "0189100e-1e29-115c-ec96-b857cd155f4a", "state": "RUNNING" }, "id": "0189100e-1e29-115c-ec96-b857cd155f4a" }' https://localhost:8443/nifi-api/processors/0189100e-1e29-115c-ec96-b857cd155f4a/run-status&lt;/PRE&gt;&lt;P&gt;Has anyone an idea what's the problem?&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;Maik&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 13:17:09 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374286#M241937</guid>
      <dc:creator>CommanderLaus</dc:creator>
      <dc:date>2023-07-21T13:17:09Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop a NiFi Processor via REST API: Desired State is not set</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374287#M241938</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/106070"&gt;@CommanderLaus&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you sure that your post data is correct? It needs to be in the following format:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "revision": {
	    "clientId": "value",
	    "version": 0,
	    "lastModifier": "value"
	},
    "state": "value",
    "disconnectedNodeAcknowledged": true
}&lt;/LI-CODE&gt;&lt;P&gt;yours looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
	"revision": {
		"version": 18,
		"clientId": "01891026-da00-199f-9dc9-ae3a37dce067"
	},
	"status": {
		"runStatus": "RUNNING"
	},
	"component": {
		"id": "0189100e-1e29-115c-ec96-b857cd155f4a",
		"state": "RUNNING"
	},
	"id": "0189100e-1e29-115c-ec96-b857cd155f4a"
}&lt;/LI-CODE&gt;&lt;P&gt;refer to : &lt;A href="https://nifi.apache.org/docs/nifi-docs/rest-api/index.html" target="_blank"&gt;https://nifi.apache.org/docs/nifi-docs/rest-api/index.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;If that helps please accept solution.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 13:28:22 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374287#M241938</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-07-21T13:28:22Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop a NiFi Processor via REST API: Desired State is not set</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374288#M241939</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/80381"&gt;@SAMSAL&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;thank you very much, you where absolutely right. I tried so many solutions from other members from other topics, that I completly messed up my own one.&lt;/P&gt;&lt;P&gt;Nice one, thank's again&lt;/P&gt;&lt;P&gt;Maik&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 13:47:12 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374288#M241939</guid>
      <dc:creator>CommanderLaus</dc:creator>
      <dc:date>2023-07-21T13:47:12Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop a NiFi Processor via REST API: Desired State is not set</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374289#M241940</link>
      <description>&lt;P&gt;Hello again,&lt;/P&gt;&lt;P&gt;if I start the processor via API, the "version" of the processor counts up. In my case above from version 18 to version 19.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I want to stop the processor now via API, I have to submit the new version 19.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to start/stop the processoer without the up-to-date version? Or is it possible, that I get the current version &lt;STRONG&gt;only&lt;/STRONG&gt; via API, save it as a variable (e.g. $version) and use this variable in my next API-Call?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greetings&lt;/P&gt;&lt;P&gt;Maik&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 14:17:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374289#M241940</guid>
      <dc:creator>CommanderLaus</dc:creator>
      <dc:date>2023-07-21T14:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: Start/Stop a NiFi Processor via REST API: Desired State is not set</title>
      <link>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374290#M241941</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/106070"&gt;@CommanderLaus&lt;/a&gt; ,&lt;/P&gt;&lt;P&gt;If you do anything manually with the processor you are trying to change its Running State through the API, then yes the revision will be updated. In my case what I do is basically the first API InvokeHttp is to get the latest revision using the following GET API:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;https://localhost:8443/nifi-api/processors/${pipeline.start.processor.id}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This will give the following response where you can parse the latest "&lt;STRONG&gt;version&lt;/STRONG&gt;" value using something like EvaluateJsonPath processor and store the value in an attribute:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "revision": {
	    "clientId": "value",
	    "version": 0,
	    "lastModifier": "value"
	},
    "id": "value",
    "uri": "value",
    "position": {…},
    "permissions": {…},
    "bulletins": [{…}],
    "disconnectedNodeAcknowledged": true,
    "component": {…},
    "inputRequirement": "value",
    "status": {…},
    "operatePermissions": {…}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then use extracted version attribute to build the next API post Body , for example in my case I use ReplaceText processor to generate the post body :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
    "revision": {
	    "clientId": "${pipeline.start.processor.id}",
	    "version": ${processorVersion}
	   
	},
    "state": "...",
    "disconnectedNodeAcknowledged": true
	
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jul 2023 14:49:14 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/Start-Stop-a-NiFi-Processor-via-REST-API-Desired-State-is/m-p/374290#M241941</guid>
      <dc:creator>SAMSAL</dc:creator>
      <dc:date>2023-07-21T14:49:14Z</dc:date>
    </item>
  </channel>
</rss>

