This question is not how about to search within folders, but why I'm not getting the correct results.
This is how I'm formatting my search request which is basically a search for "mount" inside two folders.
GET: https://www.googleapis.com/drive/v3/files?q=fullText contains 'mount' AND ('{folder_id}' in parents OR '{folder_id}' in parents)
Headers:
Authorization: Bearer {access_token}
Which gets me this response:
{
"kind": "drive#fileList",
"incompleteSearch": false,
"files": []
}
When I make the request with code, I don't get any results nor when I use an API client to manually send the request. But, whenever I use the "Try it now" in the Google Drive files list API I do get results... which is perplexing to me since I'm using the exact same query there (copy/pasting). Can anyone see what I'm doing wrong?
I'm using these permissions
Things I've tried:
In order to correctly understand your situation, I asked the following 4 questions.
The account of {access_token}
of Authorization: Bearer {access_token}
is the same as the account you tested But, whenever I use the "Try it now" in the Google Drive files list API I do get results
?
When you tested "Try it now", you used other parameters except for q
?
As a test case, when you use only the scope of https://www.googleapis.com/auth/drive
and retrieve the access token again and test your request, what result will you obtain?
When you test the following curl command by replacing ###
with your access token and placing folderId1
and folderId2
with your folder IDs, what result will you obtain?
curl -H "Authorization: Bearer ###" "https://www.googleapis.com/drive/v3/files?q=fullText%20contains%20%27mount%27%20AND%20(%27folderId1%27%20in%20parents%20OR%20%27folderId2%27%20in%20parents)"
As the result, from the section 1, it was found as follows.
I went through your questions again very carefully and I realized that I'm using a Google Service Account and not the main account. So, technically, it was not the same account even though the Google Service Account had access to some folders of the main account, but not all of folders.