Google api 谷歌服务例外:在谷歌硬盘上传新版本文件时,fieldNotWritable

Google api 谷歌服务例外:在谷歌硬盘上传新版本文件时,fieldNotWritable,google-api,google-drive-api,google-apis-explorer,google-php-sdk,Google Api,Google Drive Api,Google Apis Explorer,Google Php Sdk,我的目的是能够上传一个新版本的文件,这是已经在谷歌驱动器 我已经从上的PHP示例开始 结果我得到了 Google_Service_Exception: { "error": { "errors": [ { "domain": "global", "reason": "fieldNotWritable", "message": "The resource body includes fields which are not directly writable."

我的目的是能够上传一个新版本的文件,这是已经在谷歌驱动器

我已经从上的PHP示例开始

结果我得到了

Google_Service_Exception: {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "fieldNotWritable",
    "message": "The resource body includes fields which are not directly writable."
   }
  ],
  "code": 403,
  "message": "The resource body includes fields which are not directly writable."
 }
}
我不知道哪些字段是不可写的。我唯一要更改的是文件的实际内容,而不是元数据


有什么问题吗?

看看
$file=$this->service->files->get($fileID)
返回的
$file
对象。我的猜测是,它包含一系列字段,这些字段在

因此,当您在
$file=$this->service->files->update($fileID,$file,
中向驱动器发送相同的$file对象时,驱动器会反对它们的存在。因为您只更新内容,所以您可以发送一个空的元数据对象来代替$file


另外,正如Siawa所指出的,您正在关注的快速启动被标记为v2,但是如果您使用的是最新的PHP库,则可能已更改为v3。这是否会影响快速启动是任何人的猜测。

看看
$file=$this->service->files->get($fileID)返回的
$file
对象
。我猜它包含一系列字段,这些字段在

因此,当您在
$file=$this->service->files->update($fileID,$file,
中向驱动器发送相同的$file对象时,驱动器会反对它们的存在。因为您只更新内容,所以您可以发送一个空的元数据对象来代替$file


此外,正如Siawa所指出的,您正在关注的快速启动被标记为v2,但如果您使用的是最新的PHP库,则可能已更改为v3。这是否会影响快速启动是任何人的猜测。

这可能与API的v3中的更改有关吗?它可能与API的v3中的更改有关吗?
Google_Service_Exception: {
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "fieldNotWritable",
    "message": "The resource body includes fields which are not directly writable."
   }
  ],
  "code": 403,
  "message": "The resource body includes fields which are not directly writable."
 }
}