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

Empty Array from Google_Service_MyBusiness_ReportLocationInsightsRequest

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

I am trying to retrieve reports related to my business account, but all that i am getting as response is an empty array.

Here is the code that i am using to make the API call :

 

$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();
$start = date('Y-m-d\Th:i:s.000\Z', strtotime('2017-06-01 00:00:00'));
$end = date('Y-m-d\Th:i:s.000\Z', strtotime('2017-06-30 23:59:59'));
$timeRange->setStartTime($start);
$timeRange->setEndTime($end);
$basicRequest->setTimeRange($timeRange);
$reportLocationInsightsRequest->setBasicRequest($basicRequest);
$locations = $this->getLocations($owner);
$locationsNames = array_column($locations, 'name');
$locationsService = $this->get($owner, 'accounts_locations');
$reportLocationInsightsRequest->setLocationNames($locationsNames);
$reportLocationInsightsResponse = $locationsService->reportInsights($this->getAccount($owner)['name'], $reportLocationInsightsRequest);
$locationMetrics = $reportLocationInsightsResponse->getLocationMetrics();

Is there any way to know why i am getting an empty response ?

 

Bes Regards,

Arbi

 

1 Expert replyverified_user

Re: Empty Array from Google_Service_MyBusiness_ReportLocationInsightsRequest

Google Employee
# 2
Google Employee

Hi @Ab T,

 

Our team is looking into this issue. I'll let you know as soon as I have an update on this. Thanks for your patience!

 

Thanks,

Shalini, Google My Business API Team

Empty Array from Google_Service_MyBusiness_ReportLocationInsightsRequest

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Thank you! The update helps!