Reputation: 2198
in order to retrieve the contents of a folder I have to use the following url https://www.googleapis.com/drive/v2/files?q='root' so I thought it should be working by passing an additional parameter
@client.execute(
:api_method => @drive.files.list ,
:parameters =>{q=> "title='root'" })
But this does not work
An error occurred: {"errors"=>[{"domain"=>"global", "reason"=>"invalid", "message"=>"Invalid Value", "locationType"=>"parameter", "location"=>"q"}], "code"=>400, "message"=>"Invalid Value"}
This is pretty obvious when I see the request uri
https://www.googleapis.com/drive/v2/files?q=title%253D%27levelA%27
My first attempt was to user URI.encode "title='root'" which does not work neither. I really dont know how I could keep the single quotes ?
Best, Philip
p.s.: a link to the mentioned gem http://rubydoc.info/github/google/google-api-ruby-client/frames
Upvotes: 0
Views: 405
Reputation: 2198
ok, now I found a working solution, even though it is a very cumbersome one.
search = CGI.escape("q='root'")
u.query = search
u= Addressable::URI.parse "https://www.googleapis.com/drive/v2/files"
req=Google::APIClient::Request.new(:uri=> u)
client.execute req
I hope this helps someone..
Upvotes: 1