I'm working on a project with the Google Drive API and I found an inconsistency that either has to do with the Drive API or httr's way of handling headers.
I want to get the list of files in a specific folder on Drive, and if I send a GET request using this url:
https://www.googleapis.com/drive/v2/files?q='FOLDER_ID_HERE'+in+parents&key={YOUR_API_KEY}
Everything comes back correctly. If I use the httr::GET function with httr::add_headers, however:
GET("https://www.googleapis.com/drive/v2/files",
config(token=gtoken),
add_headers("q" = "'FOLDER_ID_HERE' in parents"))
I end up receiving some documents that do not have that folder ID as a parent folder. What gives?
It's the same for query, too. Turns out it's the quotes. If you switch double and single quotes there, it works. It's a problem with Drive IDs and url escaping.