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

List all places under my business api

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

Hello,

I am trying to get list of locations from my business API, but I am
not sure about the way even after searching a documentation.

I am using PHP client from that site
(https://developers.google.com/my-business/samples/ ) and
credential I have got when I was creating business api account.

 

The problem is that I can see only one account after calling a list
method - that is the API account and it does not have any stores under it.

 

Call source code:

 

$googleClient = new Google_Client();
$googleClient->useApplicationDefaultCredentials();
$googleClient->addScope("https://www.googleapis.com/auth/plus.business.manage");
$googleClient->addScope(Google_Service_Plus::PLUS_ME);
$googleBusiness = new Google_Service_MyBusiness($googleClient);
$result = $googleBusiness->accounts->listAccounts();


 

it returns ListAccountsResponse object which contains only one
account (API)

 

Dumped account object:

internal_gapi_mappings protected => array ()
accountName => NULL
name => "accounts/105154061200768320715" (30)
role => NULL
stateType protected => "Google_Service_MyBusiness_AccountState" (38)
stateDataType protected => ""
type => "PERSONAL" (8)
modelData protected => array (1)
state => array (1)
status => "UNVERIFIED" (10)
processed protected => array ()

 

Please, tell me if there is some stuff I need to do, so this API
account can see all the locations stored in My Business.

 

Sincerely,
David

1 Expert replyverified_user

Re: List all places under my business api

Google Employee
# 2
Google Employee

Hi @David B,

 

If you are building a service account application, I suggest you please check out this Accepted Solution for setting up a service account application.

 

Thanks,

Shalini, Google My Business API team