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

Google My Business Insight API

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I am attempting to pull insights data into a dashboard for some of my companies.  I am using a service account and the Google recommended v3.3 .NET wrapper to do so.  I am using the exact same service authorization methods that I use to access other My Business data, but for some reason, the Insights data is just coming back with a response object with null entries, even though there is Insights data for the company I am trying. Here is the code I am using, what am I doing wrong?

 

 

public ReportLocationInsightsResponse GetInsightsInformation(List<Location> locationNames)
{
     var service = RetrieveService(); // THIS GETS THE SERVICE, JUST LIKE I DO WITH THE OTHER GMB DATA

     var basicMetrics = new BasicMetricsRequest
     {
          TimeRange = new TimeRange
               {
                    StartTime = DateTime.Now.AddDays(-30),
                    EndTime = DateTime.Now
               },
          MetricRequests = new List<MetricRequest>()
     };


     var metric = new MetricRequest {Metric = "ALL"};
     basicMetrics.MetricRequests.Add(metric);

 

     var insightsRequestBody = new ReportLocationInsightsRequest
     {
          BasicRequest = basicMetrics,
          LocationNames = new List<string>()
     };


     foreach (var location in locationNames)
     {
           insightsRequestBody.LocationNames.Add(location.Name); // THIS IS THE NAME PROPERTY OF LOCATIONS RETRIEVED WITH THE API
     }

 

     var insightsRequestCall = service.Accounts.Locations.ReportInsights(insightsRequestBody, "accounts/{ account }");
     var insightsReponse = insightsRequestCall.Execute();


     return insightsReponse;

}

1 Expert replyverified_user

Re: Google My Business Insight API

Google Employee
# 2
Google Employee

Hi @Support O-A,

 

Since the C# client library doesn’t currently support the display of detailed error messages, I suggest you follow the Make a simple HTTP request step-by-step guide on the documentation website to use the OAuth 2.0 Playground to experiment with the Google My Business API. This usually helps pinpoint where an application is passing the incorrect info.

 

Thanks,

The Google My Business API team

Google My Business Insight API

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Re: Google My Business Insight API

Google Employee
# 4
Google Employee

Hi @Support O-A,

 

Please confirm us if you were able to access insights data for your location using the OAuth 2.0 Playground?

 

Thanks,

The Google My Business API team

Google My Business Insight API

Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭
There is the response I get when attempting to connect following the instructions here: 
https://developers.google.com/my-business/content/get-started#make_a_simple_http_request

HTTP/1.1 404 Not Found Content-length: 150 X-xss-protection: 1; mode=block X-content-type-options: nosniff Transfer-encoding: chunked Vary: Origin, X-Origin, Referer Server: ESF -content-encoding: gzip Cache-control: private Date: Thu, 22 Jun 2017 19:56:34 GMT X-frame-options: SAMEORIGIN Alt-svc: quic=":443"; ma=2592000; v="39,38,37,36,35" Content-type: application/json; charset=UTF-8
{
 
"error": {
   
"status": "NOT_FOUND",
   
"message": "Method ListAccounts not found for service mybusiness.googleapis.com",
   
"code": 404
 
}
}

What doesn't make sense to me is why I can get reviews and categories and all the other GMB data, but I only get an empty object returned on insights. Please answer that for me.

Re: Google My Business Insight API

Google Employee
# 6
Google Employee

Hi @Support O-A,

 

The 404 Method not found error typically happens when you are using a different Project ID from the one we whitelisted for your company to access the Google My Business API.

 

We’ll reach out to you privately in a separate email thread for more details.

 

Thanks,

The Google My Business API team

Google My Business Insight API

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

I honestly feel as if you are not reading what I post.  

 

I AM ABLE TO USE MY METHODS TO ACCESS ALL GOOGLE MY BUSINESS DATA EXCEPT INSIGHTS.

 

If it were an issue with me using the wrong account, then wouldn't I be not able to access any data?

 

 

Re: Google My Business Insight API

Google Employee
# 8
Google Employee

Hi @Support O-A,

 

I apologies for the misunderstanding. This is a known issue and our team is looking into this. I'll let you know as soon as I have an update on this.Thank you for your inquiry and patience!

 

Thanks,

Shalini, The Google My Business API team

Experts in the Topic
Shalini S