I'm attempting to use the Google Ruby API client to call the Drive API to get a file's metadata, and I'm receiving the error "Missing required parameters: id." Here's the code -- what am I doing wrong? (Note: client id and secret are working fine for requesting access tokens, etc. And the error is "id", not "client id" or "file id").
client = Google::APIClient.new
drive = client.discovered_api('drive')
client.authorization.client_id = ENV["GOOGLE_CLIENT_ID"]
client.authorization.client_secret = ENV["GOOGLE_CLIENT_SECRET"]
client.authorization.redirect_uri = "http://..."
client.authorization.access_token = "..."
client.authorization.scope = "https://www.googleapis.com/auth/drive"
result = client.execute(
:api_method => drive.files.get,
:version => 'v2',
:parameters => { 'fileId' => "..."}
)
Just figured it out. The call to discovered_api was missing the version number. Should be:
drive = client.discovered_api('drive', 'v2')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.