22434

File not found error Google Drive API

I am using the Drive REST API to download a file. I am making a GET request using the file id and I get a file not found exception.

{ "error": { "errors": [ { "domain": "global", "reason": "notFound", "message": "File not found: xxxxx", "locationType": "other", "location": "file" } ], "code": 404, "message": "File not found: xxxxx" } }

I have also generated the apikey and I am using it in my GET request.The file does exist so I am unsure what I am missing here.

Answer1:

This is resolved. I wasn't providing the correct access_token when making the GET request for file metadata. I regenerated the authorization code, access_token and my code is working now.

Answer2:

Make sure <strong>scopes</strong> are corrects

var url = oauth2Client.generateAuthUrl({ access_type: 'offline', scope: ['https://www.googleapis.com/auth/drive.file', 'https://www.googleapis.com/auth/drive', 'https://www.googleapis.com/auth/drive.file', 'https://www.googleapis.com/auth/drive.metadata' ] });

Drive API declares the following scopes. Select which ones you want to grant to APIs Explorer.

Recommend

  • unable to select from ui li elements in selenium java
  • Max Independent Set in Prolog
  • jQuery.validationEngine v2.6.1 Only Validates Sometimes?
  • How to convert HTML using replace or remove commoand in C# or Java
  • gson model for json array without key
  • Glyphicons not appearing after running grunt in angular generator
  • Js Object - Getting the Value [duplicate]
  • Equivalent SSIS expression
  • What tools are available to detect heap corruption in .NET/C# program?
  • Can a single use case be partially implemented, or implemented over several phases? How to track &am
  • Partition algorithm with two loops c++
  • OpenGl draw a cylinder with 2 points glRotated
  • Why is the CSS not loading in Joomla 2.5.6?
  • Clearcase - Find out when view was created
  • JDialog blocks parent window on Windows
  • Exclusive access to L1 cacheline on x86?
  • Hyperledger Composer add a new peer
  • Finding difference between strings in Javascript
  • How to read TIFF File headers in c?
  • why declare Object in @interface When used @property In Xcode 4
  • how can i exclude files to being regenerated by docpad?
  • PHP PDO Error - : Invalid parameter number
  • Visual Basic, Check if a sheet exists in another workbook
  • In Python, is the idiom “from Module import ClassName” typical?
  • Swift: Should NSError now be considered as legacy?
  • not valid lastModified from smbfile of JCIFS library
  • Is there a way to force users to update my ionic app
  • Can't retrieve user roles
  • jQuery autocomplete not working with Turbolinks
  • Lib to protect SQL/javascript injection for java/jsp
  • How to build a 64-bit .NET DLL, with 64-bit COM interop?
  • Injected HttpContext is always null
  • Upload file to Google Cloud Storage using AngularJS multipart form data
  • How can a console application sudo itself under OS X if it needs root privileges? [closed]
  • How to set up the Twitter gem in rails app?
  • BASE64 Encode and Decode is not working
  • What alternatives are there to these switch statements?
  • Dynamic SQL with variables inside a view (SQL Server)
  • calculate daily averages for 3d array
  • Return list of all users in BOX Enterprise Account
  • When to use PDO prepared queries. mysql_real_escape error
  • PHP exec response as string?
  • Why can't python-colormath convert sRGB to Adobe RGB?
  • Failed to create any app request
  • How to Compose OSGi Based project with C++ based project?
  • Heroku push rejected - Hartl's Rails 3.2 tutorial
  • Uber API - requests endpoint cannot read read json
  • Find 5 consecutive numbers in numpy array by row, ignore duplicates
  • Failed to find version-tag string. File must be updated
  • Magento get URL before current
  • How do I formally document a C# Attribute in UML?
  • Pycharm: Marking a folder as 'sources root' is not recursive for subfolders
  • Bigquery event streaming and table creation
  • Updating both a ConcurrentHashMap and an AtomicInteger safely
  • Implicit joins and Where in Doctrine - how?
  • Web.config system.webserver errors
  • Xcode 4 NSLog Macro link in Xcode 3
  • Read text file and split every line in MSBuild
  • How to recover from a Spring Social ExpiredAuthorizationException
  • SSO with signing and signature validation doesn't work
  • Perl system calls when running as another user using sudo
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • 0x202A in filename: Why?
  • Circular dependency while pushing http interceptor
  • Matrix multiplication with MKL
  • Revoking OAuth Access Token Results in 404 Not Found
  • Error creating VM instance in Google Compute Engine
  • Hits per day in Google Big Query
  • Qt: Run a script BEFORE make
  • Converting MP3 duration time