AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

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

POST` resulted in a `500 Internal Server Error`

[ Edited ]
Follower ✭ ✭ ☆
# 1
Follower ✭ ✭ ☆

Server error: `POST` resulted in a `500 Internal Server Error` response: { "error": "internal_failure", "error_description": "Backend Error" }


Every in a while we see this error when doing multiple locations updates through the GoogleMyBusiness Api,   I am using a php reset function for the auth


public function refreshToken()
if ($this->googleClient->isAccessTokenExpired()) {
$result = $this->googleClient->refreshTokenWithAssertion();
if (!isset($result['access_token'])) {
throw new \Exception('unexpected response: ' . json_encode($result));
$this->oauth2Token = $result['access_token'];
return $this->oauth2Token;

Perhaps there is a better way?
1 Expert replyverified_user

Re: POST` resulted in a `500 Internal Server Error`

Google Employee
# 2
Google Employee

Hi @Jeremy M,


Please make sure that you are using the v1-branch of the repository on GitHub for the Google API Client Library for PHP according to the README.txt file in the PHP client library package.


Judging from the source code you provided, you are running a service account application, and the syntax of your code is incorrect for your application to resend the token request to the Google OAuth 2.0 Authorization Server, which returns an access token.


Please follow the code snippet below for using a service account with v1-branch of the Google API Client Library for PHP:

include_once "Mybusiness.php";


$client_email = ''; //Service Account Email Address

$private_key = file_get_contents('MyProject.p12'); //key.p12

$scopes = array('');


$client = new Google_Client();

$client->setApplicationName("Google My Business API Examples");


if (isset($_SESSION['service_token'])) {




// Email address of the user account to impersonate

$user_to_impersonate = '';

$credentials = new Google_Auth_AssertionCredentials(




   'notasecret',                                 // Default P12 password

   '', // Default grant type





if ($client->getAuth()->isAccessTokenExpired()) {



$_SESSION['service_token'] = $client->getAccessToken();



 We are going to create the Google My Business API

 service, and query it.


$mybusinessService = new Google_Service_Mybusiness($client);