#StackBounty: #google-api #google-drive-sdk Google Drive API returns errors "Invalid value" and "Invalid query" whe…

Bounty: 100

I was trying to request the list of all files that located in the AppDataFolder.

When I make the following request:

GET https://www.googleapis.com/drive/v2/files?spaces=appDataFolder&maxResults=1000 HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer <MyToken>
User-Agent: <MyUserAgent>

I get the following error:

HTTP/1.1 400 Bad Request
 "error": {
  "errors": [
    "domain": "global",
    "reason": "invalid",
    "message": "Invalid query",
    "locationType": "parameter",
    "location": "q"
  "code": 400,
  "message": "Invalid query"

Why does it ask me for a query if I just want to get the list of all files? Is the “q” parameter mandatory? I thought that it was some error in my code, so I downloaded the latest Google Drive SDK for Python and got the same error.

I tried to add the “q” parameter like q=title != 'foo' but it also returned Ivalid query error. Strange thing is that I can get my files list if I add the following query: q=title='<myfolder>' or title='<file1 in my folder>' or title='<file2 in my folder>'..., but if I remove title='<myfolder>' I get query error again.

I also tried another request, but it returned me an empty list, though I know that there are files in AppDataFolder:

GET https://www.googleapis.com/drive/v2/files?q='appfolder'+in+parents&access_token=<MyToken>

UPDATE: Looks like this issue is specific to a certain account. I tested all these requests with another account and get all the files hidden in appdatafolder. The requests that work:


What can be wrong with the first account?

Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.