I have an script to update the profile list using
//all this code is inside a Class, and in the class constructor, always update the token
$this->token = $this->getToken($this->accountId);
$tokenData = json_decode($this->token);
if($this->client->isAccessTokenExpired()) {
$this->client->refreshToken($tokenData->refresh_token);
$this->token = $this->client->getAccessToken();
$this->accessToken = json_decode($this->token)->access_token;
$this->saveToken($this->token,$this->accountId);
}
....
$this->service = new Google_Service_Analytics($this->client);
..
// then i ask for the profiles
$profiles = $this->service->management_profiles->listManagementProfiles("~all", "~all",array('max-results' => 500));
but when i run this code i almost always get this error
Error calling GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles?max-results=500&key=##ACESS_KEY## : (500) Backend Error
this code, sometimes work, sometimes not , i have to be very lucky to just work , and i know is not a token problem because i can run other request like getting the visits for an specific profile without problem , i reduced the max-results to 200,100,50... etc, still happening , i also have been update to the lastest code from google api , any clue?