Alteryx Designer

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

Google Maps API - Next Page Token

Highlighted
7 - Meteor

Greetings guys, 

I have been using Google Maps API in my Alteryx workflow in order to get results with longitude and latitude for specific search queries, however, I am only able to get 20 results maximum per run while I am supposed to be getting 60 max.

 

I figured that the problem is that Google API shows 20 results per page and to access the next page you would have to use their next page token as seen in the picture below:

Faresghnaim_0-1571847484817.png

Unfortunately, I was not able to think of a way to add this to my workflow or my link.

If anyone is familiar or used Google API's before and was able to add this, please help!

 

Thank you so much!

Highlighted
Alteryx
Alteryx

You will need to leverage an iterative macro in your workflow to deal with next page tokens: https://help.alteryx.com/current/IterativeMacro.htm 

 

The iteration output will need to pass the next page token back through to the next iteration. If you aren't familiar with iterative macros you can follow along with this training video: https://community.alteryx.com/t5/Videos/Build-Your-First-Iterative-Macro/m-p/55565

Highlighted
Alteryx
Alteryx

If you need a good starting point there are also plenty of examples on the public gallery: https://gallery.alteryx.com/#!search/undefined/google%20maps 

Highlighted
Alteryx
Alteryx

@Faresghnaim You can also create a new column with the next_page_token in it. You can then create a final url in the formula tool into a download tool. This will grab the API response per line. You can then use the json parse tool to parse the json results to grab the actual lat/long.

 

Side note - Google maps API charges per request so depending on the the amount, the cost can really add up. Depending on the size of the data, you can think about the location insights dataset Alteryx offers. 

Digan
Alteryx
Highlighted
Alteryx
Alteryx

@Faresghnaim additionally, you will want to set your number of iterations to 3. The Google Maps API can respond 60 results total, but in batches of 20 at a time. Therefore, it can iterate 3 times per query to return the full 60 results.

Labels