My Business
4.9K members online now
4.9K members online now
For developers who are using the Google My Business API to manage locations
Guide Me
star_border
Reply

Trouble in getting data for Metrics from Google My Business Report Insights using REST calls

[ Edited ]
U G
Visitor ✭ ✭ ✭
# 1
U G
Visitor ✭ ✭ ✭

We are trying to pull the metrics from our Google my Business Report Insights. We created a service account for the the Google My Business project and generated keys for OAuth authentication.

With the service account and key, I got a successful 200 OK response for a simple GET

GET https://mybusiness.googleapis.com/v3/accounts/account_name

I’ve tried below GET request to list all the locations. I got, status 200 OK. But, the response is null. It didn’t list any locations.

GET https://mybusiness.googleapis.com/v3/accounts/account_name/locations

We can see Editor Role permission for our service account at IAM level. Is it something we need to have a manager Role permission for the service account in order to access the data or are we missing anything at the service account level.

1 Expert replyverified_user

Re: Trouble in getting data for Metrics from Google My Business Report Insights using REST calls

Google Employee
# 2
Google Employee

Hi @U G,

 

You should request user consent for the Google Account that you need to access the Google My Business data from. You can perform this process with an OAuth 2.0 client ID during the OAuth 2.0 installed application flow, OAuth 2.0 web server application flow or via OAuth 2.0 Playground. For more information about requesting user consent for a service account application, please check out this Accepted Solution.

 

In addition, please note that you should write your code to anticipate the possibility that a granted token might no longer work for various reasons, and obtain a new token when the existing token is deemed invalid.

 

Thanks,

The Google My Business API team

Trouble in getting data for Metrics from Google My Business Report Insights using REST calls

U G
Visitor ✭ ✭ ✭
# 3
U G
Visitor ✭ ✭ ✭

Hello Shalini and thanks so much for your response!!

 

We followed the steps mentioned in Google documentation for OAuth 2.0 Authentication.

We created a service account and generate access-token for further REST requests.


With the service account and key, I got a successful 200 OK response for a simple GET

GET https://mybusiness.googleapis.com/v3/accounts/account_name


I'm trying the below GET request to list all the locations details which I can use in my further requests to gather metrics of a specific
location. I got, status 200 OK. But, the response is null. It didn’t list any locations.

GET https://mybusiness.googleapis.com/v3/accounts/account_name/locations

We were able to authenticate and execute a simple GET request with the service account. But. we are having trouble with listing
location details.

We can see Editor Role permission for our service account at IAM level. Is it something we need to have a manager Role permission for the service account in order to access the data or are we missing anything at the service account level