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

Google My Business Google_Service_MyBusiness_ReportLocationInsightsRequest not returning any data

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

I am attempting to pull data for Location Insights but as of last week when I call:

$reportLocationInsightsRequest = new Google_Service_MyBusiness_ReportLocationInsightsRequest(); it returns all empty or null arrays.

 

When I use the Oauth playground it returns data.

 

My code:

$reportLocationInsightsRequest = new Google_Service_MyBusiness_ReportLocationInsightsRequest();
$basicRequest = new Google_Service_MyBusiness_BasicMetricsRequest();
$metricRequests = new Google_Service_MyBusiness_MetricRequest();
$metricRequests->setMetric("ALL");
$basicRequest->setMetricRequests($metricRequests);
$timeRange = new Google_Service_MyBusiness_TimeRange();
$timeRange->setStartTime($startDate);
$timeRange->setEndTime($endDate);
$basicRequest->setTimeRange($timeRange);
$reportLocationInsightsRequest->setBasicRequest($basicRequest);
$reportLocationInsightsRequest->setLocationNames($loc["name"]);
//$reportLocationInsightsResponse = $locations->reportInsights($account_name, $reportLocationInsightsRequest);
$reportLocationInsightsResponse = $mybusinessService->accounts_locations->reportInsights($account_name, $reportLocationInsightsRequest);
$locationMetrics = $reportLocationInsightsResponse->getLocationMetrics();
$locationMetricsArray = array();
echo '<pre>';
var_dump($locationMetricsArray);
echo '</pre>';

1 Expert replyverified_user

Re: Google My Business Google_Service_MyBusiness_ReportLocationInsightsRequest not returning any dat

Google Employee
# 2
Google Employee

Hi @dan w,

 

Please confirm us if is this a continued error with any set of locations, or was it transient?

 

Thanks,

The Google My Business API team