How do you update an existing location with the Google My Business PHP library?

121 Views Asked by At

I have no issues connecting and pulling existing location information but had no success updating existing location data.

How do you update the store hours?

# library: https://github.com/spotonlive/php-google-my-business

# client and scope
$client = new Google_Client();
$client->useApplicationDefaultCredentials();
$client->setSubject("[email protected]");
$client->addScope("https://www.googleapis.com/auth/plus.business.manage");

# service
$mybusinessService = new Google_Service_Mybusiness($client);

// Get locations
$account_name = "accounts/ACCOUNTNUMBERHERE";
$locations = $mybusinessService->accounts_locations;
$locations_list = $locations->listAccountsLocations($account_name)->getLocations();

// update website
$locations_list[0]->setWebsiteUrl("https://www.newwebsitehere.com");
0

There are 0 best solutions below