1

我对谷歌电子表格 API 有点陌生,我试图从谷歌得到正确的回应,现在我被 ETag 困住了。事实是,像这样的标准 GET 查询我根本没有得到任何 ETag:

https://spreadsheets.google.com/feeds/list/tCOhygAeHDCgliY3E8uONNA/od6/private/full/

回应是:

<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:gsx="http://schemas.google.com/spreadsheets/2006/extended"
xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/">
<id>
https://spreadsheets.google.com/feeds/list/tCOhygAeHDCgliY3E8uONNA/od6/private/full
</id>
<updated>2013-09-30T11:39:01.088Z</updated>
<category scheme="http://schemas.google.com/spreadsheets/2006"     term="http://schemas.google.com/spreadsheets/2006#list"/>
<title type="text">Sheet1</title>
<link rel="alternate" type="text/html" href="https://spreadsheets.google.com/ccc?key=tCOhygAeHDCgliY3E8uONNA"/>
<link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="https://spreadsheets.google.com/feeds/list/tCOhygAeHDCgliY3E8uONNA/od6/private/full"/>
<link rel="http://schemas.google.com/g/2005#post" type="application/atom+xml" href="https://spreadsheets.google.com/feeds/list/tCOhygAeHDCgliY3E8uONNA/od6/private/full"/>
<link rel="self" type="application/atom+xml" href="https://spreadsheets.google.com/feeds/list/tCOhygAeHDCgliY3E8uONNA/od6/private/full"/>
<author>
<name>promo</name>
<email>promo@balderbetter.com</email>
</author>
<openSearch:totalResults>1</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<entry>
<id>
https://spreadsheets.google.com/feeds/list/tCOhygAeHDCgliY3E8uONNA/od6/private/full/cokwr
</id>
<updated>2013-09-30T11:39:01.088Z</updated>
<category scheme="http://schemas.google.com/spreadsheets/2006" term="http://schemas.google.com/spreadsheets/2006#list"/>
<title type="text">Value 1</title>
<content type="text">header2: Value 2</content>
<link rel="self" type="application/atom+xml" href="https://spreadsheets.google.com/feeds/list/tCOhygAeHDCgliY3E8uONNA/od6/private/full/cokwr"/>
<link rel="edit" type="application/atom+xml" href="https://spreadsheets.google.com/feeds/list/tCOhygAeHDCgliY3E8uONNA/od6/private/full/cokwr/1jlaa31hglf"/>
<gsx:header1>Value 1</gsx:header1>
<gsx:header2>Value 2</gsx:header2>
</entry>
</feed>

我在这里参考https://developers.google.com/google-apps/spreadsheets/?hl=ru#retrieving_a_list-based_feed ,它在这种类型的响应中显示 ETag 存在!

但是正如您所看到的,无论是在标头中还是在 enrty 节点 (gd:etag) 中都没有任何 ETag 是我还是 Google 只是更改了架构而没有通知我们?

ps抱歉英语不好,提前感谢您的帮助

4

1 回答 1

1

在我的请求中添加HTTP 标头“GData-Version: 3.0”为我解决了这个问题。

在添加标题之前,提要和条目元素都没有指定的 ETag。

文档指出没有必要指定标头,因为版本 3.0 应该是默认值,但似乎省略它确实有一些副作用。

于 2014-03-22T14:40:18.590 回答