I am trying to figure out how to make a raw request to Google drive to access a public folder.
https://www.googleapis.com/drive/v2/files?q=0B-eVxZFKAu61TmFQUUFPbzBmVVU&key=__________
However, that URL gives the following error:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value",
"locationType": "parameter",
"location": "q"
}
],
"code": 400,
"message": "Invalid Value"
}
}
Which tells me that perhaps I'm not supposed to pass the ID of the folder inside q=
.
On a related note, I know you can access individual public files with a request like this:
https://docs.google.com/document/pub?id=_____
You are correct in that you have passed an invalid value for the q
parameter. The q
parameter receives a combination of fields, values and operators. You passed the the folder id through q
, but you didn't specify which field to match that id with.
What you need to pass to q
is '0B-eVxZFKAu61TmFQUUFPbzBmVVU' in parents
(don't leave out the single-quotes!). So, your query would look like: https://www.googleapis.com/drive/v2/files?q='0B-eVxZFKAu61TmFQUUFPbzBmVVU'+in+parents&key={YOUR_API_KEY}
.
Check out this API page to learn more about the format to use for q
.