找不到文件错误 Google Drive API [英] File not found error Google Drive API

查看:30
本文介绍了找不到文件错误 Google Drive API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Drive REST API 下载文件.我正在使用文件 ID 发出 GET 请求,但得到 file not found exception.

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"
 }
} 

我还生成了 apikey,并在我的 GET 请求中使用它.该文件确实存在,所以我不确定我在这里缺少什么.

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.

推荐答案

解决了.在对文件元数据发出 GET 请求时,我没有提供正确的 access_token.我重新生成了授权码 access_token 并且我的代码现在可以工作了.

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.

这篇关于找不到文件错误 Google Drive API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆