Issues with Google Business API

71 Views Asked by At

I have an issue with Google Business API, I'm trying to access reviews from location but Google keeps on throwing more problems. Here is a part of my code:

 <script src="https://apis.google.com/js/api.js"></script>
  <script>
    place_id = "abcdefg";
    apiKey = "abcefg";
    clientId = "abcdefg.apps.googleusercontent.com";
  </script>

  <script>
    function start() {
      gapi.client
        .init({
          apiKey: apiKey,
          clientId: clientId,
        })
        .then(function () {
          // 3. Initialize and make the API request.
          return gapi.client.request({
   path:`https://mybusiness.googleapis.com/v4/accounts/${clientId}/locations/${place_id}/reviews`,
          });
        })
        .then(
          function (response) {
            console.log(response.result);
          },
          function (reason) {
            console.log(reason);
          }
        );
    }
    gapi.load("client", start);
  </script>

And this is one of the errors I'm fighting with currently:

"You have created a new client application that uses libraries for user authentication or authorization that are deprecated. New clients must use the new libraries instead.

I've tried both: https://mybusiness.googleapis.com/v4/{parent=accounts/*/locations/*}/reviews

and

https://mybusiness.googleapis.com/v4/accounts/{accountId}/locations/{locationId}/reviews

which is preferred way nowadays?

What should my code look like? I was digging through Google documentation but it only made more mess in my head.

0

There are 0 best solutions below