首页 > 解决方案 > 复制 Google Doc 在共享驱动器中不起作用 (404)

问题描述

我正在尝试通过 REST 使用 Google Docs API,当我得到一个文件时,它会毫无问题地返回,但是当我尝试复制它时,我得到 404 File Not Found。我传递的有效载荷如下:

POST https://www.googleapis.com/drive/v3/files/<<FILEID>>/copy

{
  "supportsAllDrives": true,
  "name": "test",
  "parents": [
    "<<FOLDERID>>"
  ]
}

我通过具有https://www.googleapis.com/auth/drive范围的 OAuth2 进行了身份验证。

我在没有传递姓名或父母的情况下进行了测试,但这也不起作用。回应如下:

{
  "body": {
    "error": {
      "errors": [],
      "code": 404,
      "message": "File not found: <<FILEID>>."
    }
  },
  "headers": {
    "vary": "Origin, X-Origin",
    "content-type": "application/json; charset=UTF-8",
    "date": "Wed, 15 Sep 2021 12:27:10 GMT",
    "expires": "Wed, 15 Sep 2021 12:27:10 GMT",
    "cache-control": "private, max-age=0",
    "x-content-type-options": "nosniff",
    "x-frame-options": "SAMEORIGIN",
    "content-security-policy": "frame-ancestors 'self'",
    "x-xss-protection": "1; mode=block",
    "server": "GSE",
    "alt-svc": "<<ALT SVC>>",
    "transfer-encoding": "chunked"
  },
  "status": 404
}

编辑:还要注意,我发送了一个 getfields: *并且我确实将canCopy功能设置为 true

标签: google-docs-api

解决方案


推荐阅读