0
votes

I get an error when searching with the q parameter:

php code:

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

returns:

Fatal Error: Uncaught exception 'Google_ServiceException' with message 'Error calling GET https://www.googleapis.com/drive/v2/files/root/children?q=title%20%3D%20%27hello%27: (500) Internal Error'

I think it's something to do with the quotes as it works if I search for 'trashed = false'

I'm using the latest api client checked out from: http://code.google.com/p/google-api-php-client/source/checkout

2
Could you try with the APIs Explorer and tell us if it fails too? Make sure to authorize the app by toggling the OAuth 2.0 button. Also, could you try with $service->files->list(array('q' => "title = 'hello' AND root in parents"))? - Alain
I think it might have been a transient issue, I tried it with the OAuth Playground and with a PHP application and it worked as expected in both cases. - Claudio Cherubino
$service->files->list(array('q' => "title = 'hello' AND root in parents")) fails with "Fatal Error: Uncaught exception 'Google_ServiceException' with message 'Error calling GET googleapis.com/drive/v2/…: (400) Invalid Value'" - but works ok if I omit "AND root in parents" - Adam Jimenez
not transient issue - still can recreate this - Adam Jimenez
My bad, the query parameter should be "title = 'hello' AND 'root' in parents" (notice the quotes around root). - Alain

2 Answers

0
votes

Tried it again after all this time and it's now working.

0
votes

You get the same error message when you didn't ask for the right permissions. Use the scope https://www.googleapis.com/auth/drive, not (only) https://www.googleapis.com/auth/drive.file