The Google Drive API returns "Invalid" and "Invalid request" errors when requesting AppDataFolder

I tried to request a list of all the files that are in 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 he ask me for a request if I just want to get a list of all the files? Is the q parameter required? I thought it was some error in my code, so I downloaded the latest version of the Google Drive SDK for Python and got the same error.

I tried adding the "q" parameter, for example q=title != 'foo', but also returned an Ivalid request error. The strange thing is that I can get a list of files if I add the following query: q=title='<myfolder>' or title='<file1 in my folder>' or title='<file2 in my folder>'...but if I delete title='<myfolder>', I will get a query error again.

, , , AppDataFolder :

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

: , . , appdata. , :

https://www.googleapis.com/drive/v2/files?spaces=appDataFolder
https://www.googleapis.com/drive/v2/files?q='appDataFolder'+in+parents
https://www.googleapis.com/drive/v2/files?q='appfolder'+in+parents

?

2: appdata . , - API.

+4
1

" " - , . . , , " " . , , .

, , , " "

GET https://www.googleapis.com/drive/v3/files?q='appDataFolder'+in+parents&key={YOUR_API_KEY}

:

{
 "kind": "drive#fileList",
 "incompleteSearch": false,
 "files": [
 ]
}

Google Apis Explorer 0 , Google apis explorer Google.

Anwser: Appdata , . - , , , .

q

, q .

'appDataFolder' in parents

AppData .

:

q = title= '' title= '' title= ''..., title= ''

, appdata, , Google, appdata. , , , . , , .

2:

q = 'appDataFolder'

, , appDataFolder.

q = 'appfolder'

appfolder, Google , appDataFolder

= ''

, .

spaces = appDataFolder

, V3. ,

0

Source: https://habr.com/ru/post/1696108/


All Articles