在询问配置文件列表时,Google AnalyticsAPI会不断获得错误500

时间:2014-12-16 12:07:53

标签: php google-analytics-api

我有一个脚本来使用

更新个人资料列表
//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));

但是当我运行此代码时,我几乎总是会遇到此错误

Error calling GET https://www.googleapis.com/analytics/v3/management/accounts/~all/webproperties/~all/profiles?max-results=500&key=##ACESS_KEY## : (500) Backend Error

这段代码,有时工作,有时不工作,我必须非常幸运才能工作,而且我知道这不是一个令牌问题,因为我可以运行其他请求,例如获取特定配置文件的访问没有问题,我减少了最大结果为200,100,50 ......等等,仍然在发生,我也对谷歌api的最新代码进行了更新,任何线索?

0 个答案:

没有答案