Creating multiple records from a Google Maps search result

Hello,

I am trying to use Google Maps to find places that meet a certain criteria, such as a certain type of restaurant. I was able to successful make a Custom Action using “nearbysearch”, which will return 20 place objects at a time.

I would like to add those 20 objects to an Adalo db. This is my challenge. It will only add the first search result as one record to the db. The other 19 are not added.

How do you define an action that will add all 20 results into a db?

This is an example of the search string I used:
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=42.352376%2C-71.046554&radius=500&type=restaurant&key=*myKey*

Below is a portion of the result that I received from my Google Maps search.

Thank you in advance for any help you can provide.

{
   "html_attributions" : [],
   "next_page_token" : "AZose0kN-DIcoYVRC-OOXHwny2hKzzPscDgGlS9qc8snULJqp4r_IDNzo9iLJvlltrUrSG4MpEpfxyD316R5UroV6TlXmkcK6UbID-6HyMoEt3qRVCd0G6lrJB-XeRoJIIuASVTe8u5q_jibgZ_6e_xcPs0361CpNkMsXNzBvsZa69XRCd0eM0W0R7CdE4MPLyzzgnS_k3JBVmc-hgYstLF4y3reTs-8pPHOQ3bXuftfdpx40FgXfBjCerC0XK5DicQYNZ-D0BWuAe3WdRZWSHxdFh9JivRl-dT0X438Lpvs3JV0C6rLJum6RE66yuvPZ_2r5rlr6Hk6WJQJ4OthqLjI9R6EP99GtlxiQulg33oArwKFoBhmtwYMhUNHb6oabObSxgeuA3p-tkk3B7Ns_WRnwOgZpudfhHVwEIqZAbnOf8uLzmC25GZF1vu40pwB",
   "results" : [
      {
         "business_status" : "OPERATIONAL",
         "geometry" : {
            "location" : {
               "lat" : 42.35123,
               "lng" : -71.0487471
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 42.3525322802915,
                  "lng" : -71.04736741970849
               },
               "southwest" : {
                  "lat" : 42.3498343197085,
                  "lng" : -71.0500653802915
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png",
         "icon_background_color" : "#FF9E67",
         "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet",
         "name" : "Flour Bakery + Cafe",
         "opening_hours" : {
            "open_now" : true
         },
         "photos" : [
            {
               "height" : 2160,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/100281328131250007584\"\u003eJoe Pato\u003c/a\u003e"
               ],
               "photo_reference" : "AZose0kdMR5xkviT__s9SGHxURYHUiOMt7_2fGcdeDou4uJ98KzVUjifeZAU12lhG3VdzjtuqgUSLrptY7rOYaydCpRhtrzmlqUYMSzuPcYg6sC_7odEX0T5VIPbjtUU8qU205vnQ1IrmDml4cLCUCanGfqyFh8jyRlm6XL2BKWUCOR2ERqs",
               "width" : 3840
            }
         ],
         "place_id" : "ChIJFXmZ8X9w44kR_4B7jZwILFQ",
         "plus_code" : {
            "compound_code" : "9X22+FG Boston, MA, USA",
            "global_code" : "87JC9X22+FG"
         },
         "price_level" : 2,
         "rating" : 4.6,
         "reference" : "ChIJFXmZ8X9w44kR_4B7jZwILFQ",
         "scope" : "GOOGLE",
         "types" : [
            "bakery",
            "restaurant",
            "food",
            "point_of_interest",
            "store",
            "establishment"
         ],
         "user_ratings_total" : 1565,
         "vicinity" : "12 Farnsworth Street, Boston"
      },
      {
         "business_status" : "OPERATIONAL",
         "geometry" : {
            "location" : {
               "lat" : 42.3504581,
               "lng" : -71.04822969999999
            },
            "viewport" : {
               "northeast" : {
                  "lat" : 42.3517800802915,
                  "lng" : -71.0470300697085
               },
               "southwest" : {
                  "lat" : 42.3490821197085,
                  "lng" : -71.0497280302915
               }
            }
         },
         "icon" : "https://maps.gstatic.com/mapfiles/place_api/icons/v1/png_71/restaurant-71.png",
         "icon_background_color" : "#FF9E67",
         "icon_mask_base_uri" : "https://maps.gstatic.com/mapfiles/place_api/icons/v2/restaurant_pinlet",
         "name" : "Menton",
         "opening_hours" : {
            "open_now" : false
         },
         "photos" : [
            {
               "height" : 1867,
               "html_attributions" : [
                  "\u003ca href=\"https://maps.google.com/maps/contrib/105296461670705606973\"\u003eMenton\u003c/a\u003e"
               ],
               "photo_reference" : "AZose0n0uQvFuuAqe5ef97a1w_b-ZEmF2I_6v2MJbCayXPnnyJQkeyCLjZO_uelLdTOCRs16a-xQtnbHuacS-34PZh7uAhxie44Er2ZY9VyCyelcaxC2zNdKtrkF3MqVRH4Kb5BI6ayUUdDS70OIS7BMnPJfdPShDwdhSdR99bFbMHQ1hcl9",
               "width" : 2800
            }
         ],
         "place_id" : "ChIJzxItH4B644kR5yivbnoZZgE",
         "plus_code" : {
            "compound_code" : "9X22+5P Boston, MA, USA",
            "global_code" : "87JC9X22+5P"
         },
         "price_level" : 4,
         "rating" : 4.5,
         "reference" : "ChIJzxItH4B644kR5yivbnoZZgE",
         "scope" : "GOOGLE",
         "types" : [ "bar", "restaurant", "food", "point_of_interest", "establishment" ],
         "user_ratings_total" : 485,
         "vicinity" : "354 Congress Street, Boston"
      },```

Hi,

I think connect API results with list and then use countdown to create records in your database.

Hi, thanks for the speedy response!!

I am new to Adalo, so it is not clear to me how to connect the API results to a list. Is it possible to elaborate a little bit more on how you envision that working?

My current understanding is that a list is a UI element that is directly connected to a table. Are you referring to a different type of list?

Thank you again. Your response if very much appreciated.

Hi,

Follow this -

  1. Use the external database section to connect API.
  2. Now create a custom list, connect with the external database which you just created and drop the countdown there.
  3. Now on countdown set CREATE action to add the record to your database.

Keep in mind you can manipulate result coming via API using query method.

I hope this helps.

Hi again,

Thank you for this expanded explanation. So I need to setup my access to the Google Maps Places API as an external collection. I made an initial pass at this. I was not successful.

You need to setup the Endpoint Actions. I used my initial call to “nearbysearch” to work for “Get All Records”. But was unclear on how to setup the calls to:

  • Get one record
  • Create a record
  • Update a record
  • Delete a record

I will explore this further further.

Thanks again for the suggestion.