Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

GeoCodio Batch API / Macro

EW
11 - Bolide

I've been using GeoCodio's API to geocode addresses in Alteryx.  I've even made a little macro for it, even though I'm fairly new at both Alteryx macros and APIs.  It works so far, but I'd like to speed it up by switching to the batch address API.  

 

I'm not sure how to format the URL in Alteryx to include multiple addresses.  I've been trying to figure it out from the GeoCodio Documentation and Googling but I haven't made headway so far.  I'm very much a beginner with using APIs.

 

Is anyone else using GeoCodio's batch geocoding API in Alteryx successfully?  Or familiar enough in general to point me in the right direction?  Any help is greatly appreciated!  

 

I'm attaching my single address URL macro for the GeoCodio API.  Note that it requires an API key to use, which are free for their starter tier.  Below is the macro workflow with the single address API URL shown.

 

GeoCodio API with Formula.PNG

14 REPLIES 14
Luke_C
17 - Castor

Hi @EW 

 

Based on the documentation, you wouldn't send the data in the URL. You would instead send it as a payload through the download tool. It accepts a few formats. This could be accomplished mainly through the summarize tool & json build tool.

 

Can you provide a few sample records? I only see one in the attachment.

 

Luke_C_0-1652115645266.png

 

EW
11 - Bolide

Thank you @Luke_C!  I'm attaching an updated version of my example file with three addresses.

 

I'm not familiar with composing payloads for the download tool, I'll need to see if I can figure that out.  But your answer definitely points me in the right direction!  

Luke_C
17 - Castor

Hi @EW 

 

Here's something that will get you going in the right direction. JSON can be tricky so let us know if you run into any issues.

 

Luke_C_0-1652121553003.png

 

 

 

EW
11 - Bolide

Thanks so much for your help @Luke_C!  I am still stuck on this, JSON is definitely tricky!  :)

 

I tested the JSON field and other parameters in Postman and appears to work correctly, but it's still not working in Alteryx.  The error it gives after the download tool is:

{"error":"Invalid API key","_warnings":["Ignoring parameter \"Content-Type\" as it was not expected. See full list of valid parameters here: https:\/\/www.geocod.io\/docs\/","Ignoring parameter \"JSON\" as it was not expected. See full list of valid parameters here: https:\/\/www.geocod.io\/docs\/"]}

 

I've triple checked that my API key works with the single address API, and in Postman.  I've tried adding it on the Header tab as either a constant value or the value from the api_key field.  Playing around with other settings as well, still getting the invalid API key error.  

 

I really appreciate your help on this!

Luke_C
17 - Castor

Hi @EW 

 

It's good that it's working in postman. Can you post the configurations from there?

EW
11 - Bolide

Not sure if this is the right way of sharing, but the Postman configuration screens look like this:

postman 1.PNG

postman 2.PNG

postman 3.PNG

 

I was able to get past the Invalid API error in Alteryx by checking api_key on the Payload tab instead of including it on the Headers tab.  It's giving me a different error now, and still no coordinates.  The error is below, I starred out my API key.  

{"results":{"JSON":{"query":"{\"1\":{\"street\":\"3345 Michelson Dr\",\"postal_code\":\"92612\",\"city\":\"Irvine\",\"state\":\"CA\"},\"2\":{\"street\":\"315 E Eisenhower Pkwy\",\"postal_code\":\"48108\",\"city\":\"Ann Arbor\",\"state\":\"MI\"},\"3\":{\"street\":\"12303 Airport Way\",\"postal_code\":\"80021\",\"city\":\"Broomfield\",\"state\":\"CO\"}}","response":{"error":"The address query string length is too long","results":[]}},"api_key":{"query":"*************************************","response":{"error":"Could not geocode address. Postal code or city required.","results":[]}}}}  

Luke_C
17 - Castor

hmm I'm honestly not sure, it's tough to troubleshoot without having access. My next step would be wrapping the JSON in square brackets to rule that out. Since it's working in postman there's probably something silly causing the issue in Alteryx. 

hellyars
13 - Pulsar

@EW  Did you ever sort out a working solution? I have a very similar task.  I need to convert supplier addresses to lat - long.   I am using GeoCodio, but had not yet tried the API approach.

EW
11 - Bolide

@hellyars no, I still haven't gotten the batch GeoCodio API to work, unfortunately.  I sort of put it aside for the time being.  

 

The one address at a time GeoCodio API works for me in Alteryx, just slowly.  Still my preferred geocoding tool so far, although I wish I could figure out the batch version!

Labels