<?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 create a json request for invokehttp processor from flowfile and replace the values in flowfile with response : NiFi in Support Questions</title>
    <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296332#M218196</link>
    <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/63257"&gt;@vikrant_kumar24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. &amp;nbsp;Yes, &amp;nbsp;sorry for some reason they didnt get saved in that version of the template. &amp;nbsp;I will update. &amp;nbsp;You should see or set it like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2020-05-20 at 2.34.04 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/27585i461ED7B58D9670EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-05-20 at 2.34.04 PM.png" alt="Screen Shot 2020-05-20 at 2.34.04 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. &amp;nbsp;Yes, &amp;nbsp;you will need to enter the Remote Url, and maybe more properties. &amp;nbsp; &amp;nbsp;You also need to confirm that the json content in flow file is correct. &amp;nbsp;Mine is just an example. &amp;nbsp;I do not know what service you are connect too. &amp;nbsp;That service may require username, passwords, tokens, headers, etc. &amp;nbsp;The configuration for InvokeHttp will depend on these. &amp;nbsp; If you prefer to share more details about the service you are connecting in PM we can discuss in private.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you have the response from InvokeHttp, &amp;nbsp;if the response is json, you will again do EvaluateJson, grab the values you want for the new Long/Lat, and replace or overwrite the existing attributes and continue downstream with your flow. &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. &amp;nbsp;Converting CSV to JSON is pretty typical. &amp;nbsp;The CSV-&amp;gt;JSON Method you are a working on is just fine. &amp;nbsp;You should be able to link the flowfile from that, to EvaluateJson in the flow. &amp;nbsp; &amp;nbsp;My example is just a demo to show you the concepts of EvaluateJson, UpdateAttribute, and AttributesToJson.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 20 May 2020 18:44:40 GMT</pubDate>
    <dc:creator>stevenmatison</dc:creator>
    <dc:date>2020-05-20T18:44:40Z</dc:date>
    <item>
      <title>How to create a json request for invokehttp processor from flowfile and replace the values in flowfile with response : NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296256#M218165</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I have a flowfile json request which looks like this. Actually flowfile is a csv file which I am converting to json first so that another json request can be created for invokehttp processor. But if this csv to json conversion is not required for it then I would prefer to keep it csv only.&lt;/P&gt;&lt;P&gt;{&lt;BR /&gt;"type": "record",&lt;BR /&gt;"name": "Location",&lt;BR /&gt;"fields": [{&lt;BR /&gt;"name": "Company_name",&lt;BR /&gt;"type": ["null", "string"]&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"name": "City",&lt;BR /&gt;"type": ["null", "string"]&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"name": "Country",&lt;BR /&gt;"type": ["null", "string"]&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"name": "Latitude",&lt;BR /&gt;"type": ["null", "string"]&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;"name": "Longitude",&lt;BR /&gt;"type": ["null", "string"]&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;]&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;I need to send a request to invokehttp processor which look like below -&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;"Code":"A-5678",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;"Latitude":"78.495603",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;"Longitude":"5.969756",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;"Continent":""&lt;BR /&gt;}&lt;/DIV&gt;&lt;DIV&gt;Latitude and longitude is to be taken from flowfile fields while Code and Continent (To be sent as blank string) are not available in flowfile and has to be created. How can I create this custom request. I tried evaluatejsonpath processor but unable to add&amp;nbsp;Continent as it does not take blank value.&lt;/DIV&gt;&lt;DIV&gt;Once the request is received I need to replace the Latitude and Logitude values in flow file with the response received. Please let me know how to achieve it. The final output has to be csv file.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/55311"&gt;@Shu_ashu&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/38301"&gt;@mburgess&lt;/a&gt;&amp;nbsp;Please help&lt;/DIV&gt;</description>
      <pubDate>Wed, 20 May 2020 06:51:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296256#M218165</guid>
      <dc:creator>vikrant_kumar24</dc:creator>
      <dc:date>2020-05-20T06:51:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a json request for invokehttp processor from flowfile and replace the values in flowfile with response : NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296315#M218185</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/63257"&gt;@vikrant_kumar24&lt;/a&gt;&amp;nbsp; &amp;nbsp;To add new attributes to a flow file you should use UpdateAttribute. &amp;nbsp;To get attributes from json you should use EvaluateJsonPath. &amp;nbsp;Once you have all the values you want as attributes you should use AttributesToJson and then finally send the json to invokeHttp.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your flow will look like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2020-05-20 at 10.22.40 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/27583iE8B72A727B1C4653/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-05-20 at 10.22.40 AM.png" alt="Screen Shot 2020-05-20 at 10.22.40 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the Queued Flowfile waiting on InvokeHttp is:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2020-05-20 at 10.19.58 AM.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/27584iF186E1A9049A8E1D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-05-20 at 10.19.58 AM.png" alt="Screen Shot 2020-05-20 at 10.19.58 AM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please note I did not have your original Json, just the schema above, so I created a simple JSON of the Longitute &amp;amp; Latitude values you gave me. &amp;nbsp; &amp;nbsp;I also did not touch InvokeHttp, its default. &amp;nbsp; Once you get this far, and want to work on handling the response from InvokeHttp let me know here, in another post, or a private message. &amp;nbsp; To see my entire template, check out my GitHub for the Invoke Http Demo 2 Template:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://github.com/steven-dfheinz/NiFi-Templates" target="_blank" rel="noopener"&gt;https://github.com/steven-dfheinz/NiFi-Templates&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this answer resolves your issue or allows you to move forward, please choose to ACCEPT this solution and close this topic. If you have further dialogue on this topic please comment here or feel free to private message me. If you have new questions related to your Use Case please create separate topic and feel free to tag me in your post. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Steven&amp;nbsp;@ DFHZ&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 14:33:27 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296315#M218185</guid>
      <dc:creator>stevenmatison</dc:creator>
      <dc:date>2020-05-20T14:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a json request for invokehttp processor from flowfile and replace the values in flowfile with response : NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296327#M218193</link>
      <description>&lt;P&gt;Hi Steven,&lt;/P&gt;&lt;P&gt;Thanks a lot for responding to my query. I helps a lot. I have downloaded your flow. I have few clarification questions.&lt;/P&gt;&lt;P&gt;1. In Updateattribute processor in your template - It is not adding any flow file attribute. So we need to add Code and Continent there right?&lt;/P&gt;&lt;P&gt;2. So we need to add anything in the properites of invokehttp processor? We will get response from invokeHTTP and that response needs to replace the values of longitude and latitude in original flow file. How to do that?&lt;/P&gt;&lt;P&gt;3. If original flow file is a csv file instead of json. Will the same flow work or do we need to convert csv to json first?&lt;/P&gt;&lt;P&gt;csv file is like this&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Company_name, City, Country, Latitude, Longitude&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Abc Corp, Newyork, USA, 98.765, 67.5656&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 17:11:18 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296327#M218193</guid>
      <dc:creator>vikrant_kumar24</dc:creator>
      <dc:date>2020-05-20T17:11:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a json request for invokehttp processor from flowfile and replace the values in flowfile with response : NiFi</title>
      <link>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296332#M218196</link>
      <description>&lt;P&gt;&lt;a href="https://community.cloudera.com/t5/user/viewprofilepage/user-id/63257"&gt;@vikrant_kumar24&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. &amp;nbsp;Yes, &amp;nbsp;sorry for some reason they didnt get saved in that version of the template. &amp;nbsp;I will update. &amp;nbsp;You should see or set it like this:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Screen Shot 2020-05-20 at 2.34.04 PM.png" style="width: 999px;"&gt;&lt;img src="https://community.cloudera.com/t5/image/serverpage/image-id/27585i461ED7B58D9670EE/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screen Shot 2020-05-20 at 2.34.04 PM.png" alt="Screen Shot 2020-05-20 at 2.34.04 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. &amp;nbsp;Yes, &amp;nbsp;you will need to enter the Remote Url, and maybe more properties. &amp;nbsp; &amp;nbsp;You also need to confirm that the json content in flow file is correct. &amp;nbsp;Mine is just an example. &amp;nbsp;I do not know what service you are connect too. &amp;nbsp;That service may require username, passwords, tokens, headers, etc. &amp;nbsp;The configuration for InvokeHttp will depend on these. &amp;nbsp; If you prefer to share more details about the service you are connecting in PM we can discuss in private.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once you have the response from InvokeHttp, &amp;nbsp;if the response is json, you will again do EvaluateJson, grab the values you want for the new Long/Lat, and replace or overwrite the existing attributes and continue downstream with your flow. &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. &amp;nbsp;Converting CSV to JSON is pretty typical. &amp;nbsp;The CSV-&amp;gt;JSON Method you are a working on is just fine. &amp;nbsp;You should be able to link the flowfile from that, to EvaluateJson in the flow. &amp;nbsp; &amp;nbsp;My example is just a demo to show you the concepts of EvaluateJson, UpdateAttribute, and AttributesToJson.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 20 May 2020 18:44:40 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Support-Questions/How-to-create-a-json-request-for-invokehttp-processor-from/m-p/296332#M218196</guid>
      <dc:creator>stevenmatison</dc:creator>
      <dc:date>2020-05-20T18:44:40Z</dc:date>
    </item>
  </channel>
</rss>

