<?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: How to dynamically set the value of a property in a processor when the flow is running? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347725#M235246</link>
    <description>&lt;P&gt;You can use regular expressions to filter off the attributes you don't need.&lt;BR /&gt;Let's say that you don't want the attributes "&lt;STRONG&gt;expires_in&lt;/STRONG&gt;" and "&lt;STRONG&gt;ext_expires_in&lt;/STRONG&gt;" to go on with your flowfile. In the &lt;EM&gt;UpdateRecord&lt;/EM&gt; processor you can use the following expression to remove them from the flowfile in the "&lt;STRONG&gt;D&lt;SPAN class="table-cell"&gt;elete Attributes Expression&lt;/SPAN&gt;&lt;/STRONG&gt;" field:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;^.*expires_in.*$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This will match any attribute that contains the string "expires_in" and remove it from the flowfile.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;S.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jul 2022 09:37:19 GMT</pubDate>
    <dc:creator>linssab</dc:creator>
    <dc:date>2022-07-15T09:37:19Z</dc:date>
    <item>
      <title>How to dynamically set the value of a property in a processor when the flow is running?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347700#M235240</link>
      <description>&lt;P&gt;I have a flow in which I make a call using InvokeHTTP. The http call returns a JSON response.&lt;/P&gt;&lt;P&gt;This JSON response looks like this:&lt;/P&gt;&lt;L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lkIjoiYmViYTdlZTYtOWVkYS00M2UxLTk2OTktMjAyMWM1ZjkyOTQxIiwidXRpIjoiZ3VTaG5FY0RYRWVrNGp2em1HNV9BQSIsInZlciI6IjEuMCIsIndpZHMiOlsiMDk5N2ExZDAtMGQxZC00YWNiLWI0MDgtZDVjYTczMTIxZTkwIl0sInhtc190Y2R0IjoxNTU2MjMyNzkzfQ.U1ryZqE389sKARkqQTRbFLAXAo0Ip1uaj0nEuqbKUxkswBVgMnrUbWZDJC8p6PvDSKDksMlvldXaiO6jQkrie7XYvcGGWCFSfJkH7g3VRHtD675O0NDN1yTem8mNqzKkCkDrlv5gTr7JSVFUKf155EQ-u1nCY-jwIps7MKAfpWqM393nC2uexC2tt0Fi0lVRE8NXfK_Tuk6_16a9mKATyyZE3JGBZHC1ZWQC47TcIWmmhtfMQAV3qguz-XXqeXxBtYT6LSQIJLQg5cdB1qxx4TMExmzE1U9gOScU3FPArDQQnfdzWMUH_JeYZQZG_P7JaFUWm6eSxES_YB1r9KHDMQ"
}&lt;/LI-CODE&gt;&lt;P&gt;I want to take the value of the access_token from this response, add a prefix "Bearer " to it, and plug it in to the value of a property(added by me) called "Authorization" in the next InvokeHttp processor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How should I achieve this? As is evident from my requirement, the next Invokehttp processor is dependent on this value before it can make its own http call to a different endpoint.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 05:32:33 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347700#M235240</guid>
      <dc:creator>sayak17</dc:creator>
      <dc:date>2022-07-15T05:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically set the value of a property in a processor when the flow is running?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347709#M235244</link>
      <description>&lt;P&gt;Hey&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/98950"&gt;@sayak17&lt;/a&gt;.&lt;BR /&gt;&lt;BR /&gt;You can do this in a few different ways.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In any case, the first thing to do is get the &lt;FONT face="terminal,monaco"&gt;access-token&lt;/FONT&gt;&amp;nbsp;value from the JSON response. You can achieve this with an &lt;EM&gt;ExecuteScript&lt;/EM&gt; processor as suggested in this post:&amp;nbsp;&lt;A title="NiFi - convert everything in json to attributes, not one by one (i.e JsonToAttributes) " href="https://community.cloudera.com/t5/Support-Questions/NiFi-convert-everything-in-json-to-attributes-not-one-by-one/td-p/192812" target="_blank" rel="noopener"&gt;NiFi - convert everything in json to attributes, not one by one (i.e JsonToAttributes)&amp;nbsp;&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;I have made the same script in Python if you want and it's available on &lt;A title="pythonscript" href="https://github.com/linssab/nifi-environment/blob/main/NifiPythonScriptJsonToAttr.py" target="_blank" rel="noopener"&gt;github&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now you have all the JSON values as attributes in your flowfile. If you want to get rid of attributes you won't need, you can either modify the script yourself or use an &lt;EM&gt;UpdateAttribuite&amp;nbsp;&lt;/EM&gt;processor.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To add the "Bearer" string to your access-token value, you can make use of expression language in the second &lt;EM&gt;InvokeHTTP &lt;/EM&gt;processor. Click on the&amp;nbsp;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="linssab_0-1657871489742.png" style="width: 200px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34895i9C5013D812858A13/image-size/small?v=v2&amp;amp;px=200" role="button" title="linssab_0-1657871489742.png" alt="linssab_0-1657871489742.png" /&gt;&lt;/span&gt;&amp;nbsp;icon inside the processor configuration window to add the attribute "Authorization". In the value field just add the following:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;${access-token:prepend("Bearer")}&lt;/LI-CODE&gt;&lt;P&gt;This will take the value of the &lt;STRONG&gt;attribute&lt;/STRONG&gt; access-token and prepend the string "Bearer" to it.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="linssab_1-1657871999097.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34896i200410C9E38272E3/image-size/large?v=v2&amp;amp;px=999" role="button" title="linssab_1-1657871999097.png" alt="linssab_1-1657871999097.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 08:00:35 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347709#M235244</guid>
      <dc:creator>linssab</dc:creator>
      <dc:date>2022-07-15T08:00:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically set the value of a property in a processor when the flow is running?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347719#M235245</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/97121"&gt;@linssab&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thankyou for that detailed response. I have one doubt remaining: how to use the updateattribute processor to get rid of attributes I don't need?&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 09:11:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347719#M235245</guid>
      <dc:creator>sayak17</dc:creator>
      <dc:date>2022-07-15T09:11:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically set the value of a property in a processor when the flow is running?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347725#M235246</link>
      <description>&lt;P&gt;You can use regular expressions to filter off the attributes you don't need.&lt;BR /&gt;Let's say that you don't want the attributes "&lt;STRONG&gt;expires_in&lt;/STRONG&gt;" and "&lt;STRONG&gt;ext_expires_in&lt;/STRONG&gt;" to go on with your flowfile. In the &lt;EM&gt;UpdateRecord&lt;/EM&gt; processor you can use the following expression to remove them from the flowfile in the "&lt;STRONG&gt;D&lt;SPAN class="table-cell"&gt;elete Attributes Expression&lt;/SPAN&gt;&lt;/STRONG&gt;" field:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;^.*expires_in.*$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;This will match any attribute that contains the string "expires_in" and remove it from the flowfile.&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;/P&gt;&lt;P&gt;S.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 09:37:19 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347725#M235246</guid>
      <dc:creator>linssab</dc:creator>
      <dc:date>2022-07-15T09:37:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically set the value of a property in a processor when the flow is running?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347881#M235276</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/97121"&gt;@linssab&lt;/a&gt;&amp;nbsp;For some reason, my second invokehttp is not working. When I got hold of the error message, it says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;SPAN&gt;{"error":{"code":"InvalidAuthenticationToken","message":"CompactToken parsing failed with error code: 80049217","innerError":{"date":"2022-07-18T06:12:26","request-id":"dd8bb873-dfb8-4afe-81d8-7d19bdf61a1f","client-request-id":"dd8aa873-dfb8-4afe-81d8-7d89bdz81a5f"}&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Is there any way, to see what request the invokehttp is exactly is making..let's says as curl format, or any format. Or atleast, is it possible to view what exactly it is sending in the headers?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;That will help me to debug.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 06:19:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347881#M235276</guid>
      <dc:creator>sayak17</dc:creator>
      <dc:date>2022-07-18T06:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to dynamically set the value of a property in a processor when the flow is running?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347890#M235278</link>
      <description>&lt;P&gt;Finally, it is working as intended. Both invokehttp processors are working.&lt;/P&gt;&lt;P&gt;This article worked for me:&amp;nbsp;&lt;A href="https://nagaraj-tantri.medium.com/chaining-multiple-http-apis-via-apache-nifi-72c4d14c072d" target="_blank"&gt;Chaining Multiple Http API's in Apache NiFi | Medium&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jul 2022 06:42:53 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-dynamically-set-the-value-of-a-property-in-a/m-p/347890#M235278</guid>
      <dc:creator>sayak17</dc:creator>
      <dc:date>2022-07-18T06:42:53Z</dc:date>
    </item>
  </channel>
</rss>

