为什么我使用 google 电子表格的 PUT 请求不起作用?

Why my PUT request using the google spreadsheet isn’t working?

我已经完成这里提到的每个步骤 https://developers.google.com/google-apps/spreadsheets/#changing_contents_of_a_cell 使用协议并提交请求,现在,在执行实际脚本之前使用 POSTMAN。

在通过 PUT 编辑单元格的步骤中,我收到 403 Forbidden 错误“If-Match or If-None-Match header 或需要条目 etag 属性”。

现在我的请求 URL 是:

PUT https://spreadsheets.google.com/feeds/cells/MY_SPREADSHEET_ID/od6/private/full/R1C1?v=3.0

Headers: 授权 Bearer {我的访问令牌} Content-Type application/atom+xml

原始

<entry xmlns="http://www.w3.org/2005/Atom"
    xmlns:gs="http://schemas.google.com/spreadsheets/2006">
  <id>https://spreadsheets.google.com/feeds/cells/MY_SPREADSHEET_ID/od6/private/full/R1C1</id>
  <link rel="edit" type="application/atom+xml"
    href="https://spreadsheets.google.com/feeds/cells/MY_SPREADSHIT_ID/od6/private/full/R1C1"/>
  <gs:cell row="1" col="1" inputValue="hello"/>
</entry>

有什么想法吗? ps.: 如果我删除 ?v=3.0 将会出现另一个要求版本

的错误

您应该添加 header If-Match:*

它应该开箱即用,但是,可以在 http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html

上找到更多关于主题的信息