Geocoding API Return Values

Hi,

I'm hoping someone here can help me out with using the return values of a webhook. This is may first time trying out this new-ish feature and I'm having trouble configuring the return vaules.

What I'm trying to do is simple: Get the LatLong coordinates of an address using the free maps.co API. The documentation is here: https://geocode.maps.co.

The webhook I'm using is: https://geocode.maps.co/search?q=<<ENCODEURL([Combined Address])>>

It works, and it returns the JSON of the lat and long firlds, however when I build them  in to the next step of the bot, it gives me an error:

Error: Failed Webhook type translation: Key 'lon' not found in returned object.

What am I doing wrong??

0 6 339
6 REPLIES 6

Wow!  I totally missed the Release Notes on this rolling out!!!

So...from what I gather, in your webhook step, you simply need to list the names of the returned values you want to capture and provide an AppSheet type for the value.  Do you have a value named "Ion" in the returned JSON payload?

Hi @WillowMobileSys Yeah, it's a MAJOR feature dump that kind of slipped under the radar.

Yes, In the automation monitor I can see the returned JSON. It looks like this:

{"Response":"[{\"place_id\":182196059,\"licence\":\"Data ยฉ OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright\",\"powered_by\":\"Map Maker: https://maps.co\",\"osm_type\":\"way\",\"osm_id\":336544594,\"boundingbox\":[\"39.3634916\",\"39.3636897\",\"-76.6773377\",\"-76.6771744\"],\"lat\":\"39.3636129\",\"lon\":\"-76.67726051245937\",\"display_name\":\"6001, Stuart Avenue, Cheswolde, Baltimore, Maryland, 21209, United States\",\"class\":\"building\",\"type\":\"yes\",\"importance\":0.5309999999999999}]","Task Type":"Webhook","Task Name":"Task for Call Maps API",

As you can see there is a field for lat and a field  for lon. But when I put them in as values it says could not find lan in return step data. What  am I doing wrong?

Make suring you are spelling the attributes correctly.  Originally I thought you were looking for "ION".  Make sure you are using "LAT" and "LON" as the correct spellings of those variables.

Additionally, are you sure that the service you are using returns a RESTful response?  When I break down the response JSON you provided, the response payload (portion between the curly braces)  seems to be including slashes as "escape" characters for the double-quotes.  Those probably prevent the JSON from being parsed properly.  But this could be a by-product of whatever tool you are using capture the API response.

{"Response":
"[{
\"place_id\":182196059,
\"licence\":\"Data ยฉ OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright\",
\"powered_by\":\"Map Maker: https://maps.co\",
\"osm_type\":\"way\",
\"osm_id\":336544594,
\"boundingbox\":[\"39.3634916\",\"39.3636897\",\"-76.6773377\",\"-76.6771744\"],
\"lat\":\"39.3636129\",
\"lon\":\"-76.67726051245937\",
\"display_name\":\"6001, Stuart Avenue, Cheswolde, Baltimore, Maryland, 21209, United States\",
\"class\":\"building\",
\"type\":\"yes\",
\"importance\":0.5309999999999999
}]",
"Task Type":"Webhook",
"Task Name":"Task for Call Maps API",

 

Yes, I was using the correct spelling, but wasn't including the backslash. When I try including the slash, it tells me it's an invalid character. 

I'm not so familiar with APi and webhooks and JSON in general, but I can figure out what I'm doing wrong.

the backslashes seem to be put in by the appsheet automation monitor. If you just put in the webhook into chrome (using empire state building as sample) it gives you this:

[{"place_id":111639128,"licence":"Data ยฉ OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright","powered_by":"Map Maker: https://maps.co","osm_type":"way","osm_id":34633854,"boundingbox":["40.7479226","40.7489422","-73.9864855","-73.9848259"],"lat":"40.748428399999995","lon":"-73.98565461987332","display_name":"Empire State Building, 350, 5th Avenue, Manhattan Community Board 5, Manhattan, New York County, New York, 10018, United States","class":"tourism","type":"attraction","importance":0.8515868466874569},{"place_id":60871452,"licence":"Data ยฉ OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright","powered_by":"Map Maker: https://maps.co","osm_type":"node","osm_id":5552887205,"boundingbox":["52.2956835","52.2957835","16.7553074","16.7554074"],"lat":"52.2957335","lon":"16.7553574","display_name":"Empire State Building, Poznaล„ska, Trzebaw, gmina Stฤ™szew, Poznaล„ County, Greater Poland Voivodeship, Poland","class":"tourism","type":"artwork","importance":0.30100000000000005}]

Appsheeet support got back to me and said that the JSON I'm trying to use is complex nested JSON and Appsheet doesn't support it in webhook responses as of now.

Top Labels in this Space