Google Search Console API - SearchAnalytics 500错误

时间:2015-09-18 13:47:16

标签: php api google-webmaster-tools

我正在尝试使用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);
        }

我有一个有效的令牌,它会处理请求但总是会返回以下内容:

Error calling POST https://www.googleapis.com/webmasters/v3/sites/example.com/searchAnalytics/query: (500) Backend Error

为了确保它不是由PHP代码引起的,我还尝试使用Google Api Explorer。

此处的结果相同:http://i.imgur.com/Qrm3VhS.png

我目前正在使用https://github.com/google/google-api-php-client

的开发主版本

一定有什么我做错了,我只是想不通。

1 个答案:

答案 0 :(得分:1)

您没有设置endDate(必需参数) - 请参阅official documentation

相关问题