Search code examples
google-drive-api

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.


Solution

  • 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.