Created 12-19-2017 01:42 PM
I'm trying to load weather data as http API request. Therefore I need to extract the geo information from an incoming JSON flowfile. This is my JSON data
{ "id" : 590575476, "sampling_rate" : null, "timestamp" : "2017-12-19 13:23:20", "location" : { "id" : 1311, "latitude" : "47.967", "longitude" : "7.959", "country" : "DE" }, "sensor" : { "id" : 2602, "pin" : "1", "sensor_type" : { "id" : 14, "name" : "SDS011", "manufacturer" : "Nova Fitness" } }, "sensordatavalues" : [ { "id" : 1291686812, "value" : "25.87", "value_type" : "P1" }, { "id" : 1291686813, "value" : "15.63", "value_type" : "P2" } ] }
Any idea how to access latitude and longitude as attributes for the URL in the InvokeHTTP processor?
http://api.openweathermap.org/data/2.5/weather?lat=${location.latitude}&lon=${location.longitude}&AP...
Created on 12-19-2017 03:27 PM - edited 08-17-2019 06:27 PM
Use EvaluateJSON path processor with below configs:-
then we are adding longitude and latitude attributes to the flowfile as
then use url in invoke http processor as
http://api.openweathermap.org/data/2.5/weather?lat=${location.latitude}&lon=${location.longitude}&AP...
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.
Created on 12-19-2017 03:27 PM - edited 08-17-2019 06:27 PM
Use EvaluateJSON path processor with below configs:-
then we are adding longitude and latitude attributes to the flowfile as
then use url in invoke http processor as
http://api.openweathermap.org/data/2.5/weather?lat=${location.latitude}&lon=${location.longitude}&AP...
If the Answer helped to resolve your issue, Click on Accept button below to accept the answer, That would be great help to Community users to find solution quickly for these kind of errors.