【问题标题】:Google Drive Internal Server Error when searching搜索时 Google Drive 内部服务器错误
【发布时间】:2012-08-11 14:05:35
【问题描述】:

使用 q 参数搜索时出现错误:

php代码:

$parameters['q'] = "title = 'hello'"; 
$children = $service->children->listChildren('root',$parameters);

返回:

致命错误:带有消息的未捕获异常“Google_ServiceException” '调用GET出错 https://www.googleapis.com/drive/v2/files/root/children?q=title%20%3D%20%27hello%27: (500) 内部错误'

我认为这与引号有关,因为如果我搜索“trashed = false”,它会起作用

我正在使用从以下位置签出的最新 api 客户端: http://code.google.com/p/google-api-php-client/source/checkout

【问题讨论】:

  • 您能否尝试使用APIs Explorer 并告诉我们它是否也失败了?确保通过切换 OAuth 2.0 按钮来授权应用程序。另外,你能试试$service->files->list(array('q' => "title = 'hello' AND root in parents"))吗?
  • 我认为这可能是一个暂时性问题,我使用 OAuth Playground 和 PHP 应用程序进行了尝试,并且在两种情况下都按预期工作。
  • $service->files->list(array('q' => "title = 'hello' AND root in parents")) 失败并显示“致命错误:未捕获的异常 'Google_ServiceException' 和消息'错误调用 GET googleapis.com/drive/v2/…: (400) Invalid Value'" - 但如果我省略 "AND root in parents" 则工作正常
  • 不是暂时性问题 - 仍然可以重新创建此问题
  • 我的错,查询参数应该是"title = 'hello' AND 'root' in parents"(注意root周围的引号)。

标签: php google-drive-api


【解决方案1】:

经过这么长时间再次尝试,现在可以正常工作了。

【讨论】:

    【解决方案2】:

    当您没有请求正确的权限时,您会收到相同的错误消息。使用范围https://www.googleapis.com/auth/drive,而不是(仅)https://www.googleapis.com/auth/drive.file

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-03
      • 2021-04-05
      相关资源
      最近更新 更多