Use Google place api to fill in information about an establishment

Hi everybody !
I am currently playing with Glide and the Google place api.

Today, I have the name and address of an establishment, I would like that with this information, I manage to make an API request of the API google place, so that it completes me the other information (schedules, telephones, etc)

I can do the first part, from the name and address, find the place_id, then make the request and have all the information.

Where I get stuck: retrieve the answer from the first query to get the place_id and place this place_id in a specific column. (But I guess when I can do that, I can do the next thing)

And then, once I have my query with the place_id, associate the values of the response to the right columns.

Is this possible? And if so, could you help me?

Edit : Here is what I get from the request to get the place_id

{
   "predictions" : [
      {
         "description" : "Barabaar, 4 Bd des Brotteaux, 69006 Lyon, France",
         "matched_substrings" : [
            {
               "length" : 8,
               "offset" : 0
            },
            {
               "length" : 16,
               "offset" : 12
            },
            {
               "length" : 5,
               "offset" : 30
            },
            {
               "length" : 4,
               "offset" : 36
            }
         ],
         "place_id" : "ChIJRT8dL4zq9EcRp8tR4U6yxis",
         "reference" : "ChIJRT8dL4zq9EcRp8tR4U6yxis",
         "structured_formatting" : {
            "main_text" : "Barabaar",
            "main_text_matched_substrings" : [
               {
                  "length" : 8,
                  "offset" : 0
               }
            ],
            "secondary_text" : "4 Bd des Brotteaux, 69006 Lyon, France",
            "secondary_text_matched_substrings" : [
               {
                  "length" : 16,
                  "offset" : 2
               },
               {
                  "length" : 5,
                  "offset" : 20
               },
               {
                  "length" : 4,
                  "offset" : 26
               }
            ]
         },
         "terms" : [
            {
               "offset" : 0,
               "value" : "Barabaar"
            },
            {
               "offset" : 10,
               "value" : "4 Bd des Brotteaux"
            },
            {
               "offset" : 30,
               "value" : "69006"
            },
            {
               "offset" : 36,
               "value" : "Lyon"
            },
            {
               "offset" : 42,
               "value" : "France"
            }
         ],
         "types" : [ "bar", "restaurant", "food", "point_of_interest", "establishment" ]
      }
   ],
   "status" : "OK"
}

thanks in advance!

Sincerely,
Thomas

Hi again

I saw this vidéo : Get Part of URL column • Glide

I’ve moved on, I can do it, like in the video above.

It works for Chuck Norris jokes, but not for Google place :frowning:

Any idea why?

So you already have the result of the request in Glide and now what you want is to extract info out?

Hello,

I’m not sure if this is a good idea or not, but I’m not sure if it’s a good idea to use the google place api in Glide for 2 reasons:

  • Core problem

  • " https://maps.googleapis.com/maps/api doesn’t support getting requests from frontend JavaScript running in web apps in the way your code is trying to use it.
    Instead you must use the supported Google Maps JavaScript API, the client-side code for which is different from what you’re trying"

I’ll find another way

2 Likes

Hola @Thomas_Siegwald

You can use replit or GitHub to write your code, then just use the Experimental code column to paste the link from replit/GitHub and get exactly what you need.

1 Like

Hi @SantiagoPerez ,

Thank you for your feedback,

I don’t understand, what do you mean?

I just wanted to parse the JSON I got from my query, but Google blocks the use of it, I can’t do anything about it :frowning:

I don’t have a script or a code! Just an Url that I build via my different columns

Ah Yes, I see

I test and I come back

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.