【发布时间】: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