我正在尝试使用 SearchAnalyticsQuery 从 Search Console Api 中获取一些数据。
首先我用 PHP 尝试过:
$this->client->setAccessToken( \Session::get('access_token') );
$webmaster = new \Google_Service_Webmasters( $this->client );
$q = new \Google_Service_Webmasters_SearchAnalyticsQueryRequest();
$q->setStartDate('2015-01-01');
try {
$webmaster->searchanalytics->query('http://example.com', $q);
} catch(\Exception $e )
{
dd($e);
}
我有一个有效的 token ,它执行请求,但始终返回以下内容:
Error calling POST https://www.googleapis.com/webmasters/v3/sites/example.com/searchAnalytics/query: (500) Backend Error
为了确保它不是由 PHP 代码引起的,我还使用 Google Api Explorer 进行了尝试。
这里的结果相同:/image/hWECi.png
我目前使用的是 https://github.com/google/google-api-php-client 的 dev-master 版本
一定是我做错了什么,我只是无法弄清楚。
最佳答案
您没有设置endDate
(必需参数) - 请参阅 official documentation .
关于php - Google Search Console API - SearchAnalytics 500 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32653675/