<?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 How to plug-in value from a JSON response of invokeHTTP to the next InvokeHTTP processor? in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347614#M235222</link>
    <description>&lt;P&gt;I am trying to design a flow, where I get file details from a Sharepoint site's directory.&lt;/P&gt;&lt;P&gt;For this I need to make 4 or more REST calls:&lt;/P&gt;&lt;P&gt;1. Get access token from microsoft.&lt;/P&gt;&lt;P&gt;2. Use the access token from previous JSON, to get site details.&lt;/P&gt;&lt;P&gt;3. Use the site id from previous JSON, to get drive details.&lt;/P&gt;&lt;P&gt;4. Use the drive id from previous response JSON , to list drive children.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the best approach to implement this in NiFi?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jul 2022 10:26:25 GMT</pubDate>
    <dc:creator>sayak17</dc:creator>
    <dc:date>2022-07-14T10:26:25Z</dc:date>
    <item>
      <title>How to plug-in value from a JSON response of invokeHTTP to the next InvokeHTTP processor?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347614#M235222</link>
      <description>&lt;P&gt;I am trying to design a flow, where I get file details from a Sharepoint site's directory.&lt;/P&gt;&lt;P&gt;For this I need to make 4 or more REST calls:&lt;/P&gt;&lt;P&gt;1. Get access token from microsoft.&lt;/P&gt;&lt;P&gt;2. Use the access token from previous JSON, to get site details.&lt;/P&gt;&lt;P&gt;3. Use the site id from previous JSON, to get drive details.&lt;/P&gt;&lt;P&gt;4. Use the drive id from previous response JSON , to list drive children.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What would be the best approach to implement this in NiFi?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 10:26:25 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347614#M235222</guid>
      <dc:creator>sayak17</dc:creator>
      <dc:date>2022-07-14T10:26:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to plug-in value from a JSON response of invokeHTTP to the next InvokeHTTP processor?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347628#M235225</link>
      <description>&lt;P&gt;&lt;SPAN&gt;ExtractText processor can help you grab needed information from json content and store in the flow file attribute for reuse after InvokeHTTP.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thank You&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 12:09:43 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347628#M235225</guid>
      <dc:creator>ckumar</dc:creator>
      <dc:date>2022-07-14T12:09:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to plug-in value from a JSON response of invokeHTTP to the next InvokeHTTP processor?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347642#M235226</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/98950"&gt;@sayak17&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Agree with&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/42173"&gt;@ckumar&lt;/a&gt;'s response.&amp;nbsp; It would be difficult to provide more detail without understanding the actual structure needed for the follow-on rest-api calls.&amp;nbsp; What info is expected in headers versus raw data.&lt;BR /&gt;&lt;BR /&gt;Typically the access token is sent in a header and is often needed in all subsequent rest-api calls.&amp;nbsp; Do you need to create unique FlowFile content to send as data?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;The &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.16.3/org.apache.nifi.processors.standard.ExtractText/index.html" target="_self"&gt;ExtractText&lt;/A&gt; can be used to extract the token from the response written to the FlowFiles content and added as an attribute on the FlowFile before next &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-standard-nar/1.16.3/org.apache.nifi.processors.standard.InvokeHTTP/index.html" target="_self"&gt;invokeHTTP&lt;/A&gt; processor.&amp;nbsp; Since I do not know much about Sharepoint or the format of the responses received, I can only give an example based on a returned token from NiFi's rest-api:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_0-1657804411009.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34876iB04BCF28FC8FC45D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattWho_0-1657804411009.png" alt="MattWho_0-1657804411009.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The entire response body would be placed in a FlowFile attribute named "token".&lt;BR /&gt;In the case of the NiFi token, I must then build a proper "Authorization" header with that token before being able to make additional rest-api calls using it.&amp;nbsp; To do that, you can use an &lt;A href="https://nifi.apache.org/docs/nifi-docs/components/org.apache.nifi/nifi-update-attribute-nar/1.16.3/org.apache.nifi.processors.attributes.UpdateAttribute/index.html" target="_self"&gt;UpdateAttribute&lt;/A&gt; processor:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_1-1657804591023.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34877iAB86FA9BBF19ED53/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattWho_1-1657804591023.png" alt="MattWho_1-1657804591023.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;So here I added "Bearer " to the token and write it to a new FlowFile attribute "Authorization"; although, you could also simply update the existing "token" attribute instead.&lt;BR /&gt;Then in the next InvokeHTTP processor you can pass this "Authorization" FlowFile attribute value in a header by adding a dynamic property:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MattWho_2-1657804801206.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34878iD097368A913166F2/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MattWho_2-1657804801206.png" alt="MattWho_2-1657804801206.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Beyond this, you can do similar with your follow on responses assuming each step simply requires you to use the response values you extracted as headers or custom rest-api remote URLs.&lt;BR /&gt;&lt;BR /&gt;If you found any of the response received help you address your query, please take a moment to login and then click "Accept as Solution" on every response that helped.&lt;BR /&gt;&lt;BR /&gt;Hopefully this helps you reach your end goal here,&lt;BR /&gt;Matt&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 13:23:48 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347642#M235226</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-07-14T13:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to plug-in value from a JSON response of invokeHTTP to the next InvokeHTTP processor?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347649#M235228</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/35454"&gt;@MattWho&lt;/a&gt;&amp;nbsp;Below are the screenshots of the APIs and their structure.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sayak17_2-1657805844875.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34881iA48CDC3DD7A2B8F9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sayak17_2-1657805844875.png" alt="sayak17_2-1657805844875.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sayak17_1-1657805700122.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34880iD3FB6AA9534678CF/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sayak17_1-1657805700122.png" alt="sayak17_1-1657805700122.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sayak17_3-1657806011495.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34882i82DC95930E54BD57/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sayak17_3-1657806011495.png" alt="sayak17_3-1657806011495.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="sayak17_4-1657806175532.png" style="width: 400px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/34883i7D01F2982FE7E288/image-size/medium?v=v2&amp;amp;px=400" role="button" title="sayak17_4-1657806175532.png" alt="sayak17_4-1657806175532.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>Thu, 14 Jul 2022 13:43:28 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347649#M235228</guid>
      <dc:creator>sayak17</dc:creator>
      <dc:date>2022-07-14T13:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to plug-in value from a JSON response of invokeHTTP to the next InvokeHTTP processor?</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347670#M235234</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/98950"&gt;@sayak17&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;so this looks doable as I described above.&amp;nbsp; Not sure what program you are using in your screenshots as it does not show the full rest-api call structure.&lt;BR /&gt;&lt;BR /&gt;But your process would be as as follows:&lt;BR /&gt;1. Get bearer token&lt;BR /&gt;2. Extract bearer token from response body and place in FlowFile attribute&lt;BR /&gt;3. Format flowfile attribute as needed for use by the rest of the api-calls&lt;BR /&gt;4. Using bearer token make get request to the ../sites rest-api endpoint&lt;BR /&gt;5. Use ExtractText to extract the site id to a new FlowFile Attribute&lt;BR /&gt;6. Use bearer token again and use NiFi Expression Language to dynamically create the rest-api url to include the site id.&lt;BR /&gt;7. From response, extract the Drive id to another new FlowFile Attribute as above.&lt;BR /&gt;8. Use bearer token again and use NiFi Expression Language to dynamically create the rest-api url to include the drive id.&lt;BR /&gt;9 finally do whatever you need to do with the response json you get from that final rest-api call.&lt;BR /&gt;&lt;BR /&gt;Matt&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jul 2022 16:12:30 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-plug-in-value-from-a-JSON-response-of-invokeHTTP-to/m-p/347670#M235234</guid>
      <dc:creator>MattWho</dc:creator>
      <dc:date>2022-07-14T16:12:30Z</dc:date>
    </item>
  </channel>
</rss>

