Google Spreadsheet API:发布请求失败

时间:2014-09-09 21:51:59

标签: google-spreadsheet-api

我在网上发布了Google电子表格,我正在尝试阅读和编写基于列表的Feed。我没有进行身份验证。

我可以使用GET请求读取数据。

curl https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDsadfwerF4RE0M/1/public/full

但是,我写的所有数据写入请求都会返回错误

curl --data '' https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDlN3mMaBfF4RE0M/1/public/full

curl --data '<entry xmlns="http://www.w3.org/2005/Atom" xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"><gsx:id>1</gsx:id><gsx:status>1</gsx:status><gsx:user_email>1</gsx:user_email><gsx:url domain>1</gsx:url domain><gsx:highlighted_text>1</gsx:highlighted_text><gsx:complete_text comments>1</gsx:complete_text comments><gsx:created_date>1</gsx:created_date><gsx:updated_date>1</gsx:updated_date><gsx:created_by>1</gsx:created_by><gsx:updated_by>1</gsx:updated_by></entry>' https://spreadsheets.google.com/feeds/list/1WngGKZHauwBqRxgC5E6DFMiJ-J8BDlN3mMaBfF4RE0M/1/public/full

我得到的错误是:“抱歉,您请求的文件不存在。请检查地址并重试。”

POST请求是否需要身份验证?我在docs中找不到任何说明的内容。

任何帮助将不胜感激。感谢。

1 个答案:

答案 0 :(得分:1)

两件事:

  • 我认为您需要使用私人Feed(.../private/full),而不是您现在正在使用的公共Feed(.../public/full)。有关私人与公众区别的更多信息,请参见the API docs
  • 您需要一个Authorization标题。 (这个过程非常复杂,但有很多好的信息here。请记住选择合适的范围。)

在Sheets API文档中添加列表行的示例中提到了两者。 (我直接链接,但我没有足够的代表来添加两个以上的链接。只需搜索“添加列表行”。)