Google Spreadsheets Response中没有ETag

时间:2013-09-30 12:30:13

标签: xml google-sheets google-spreadsheet-api etag

我对Google Spreadsheets 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节点中都没有任何ETag(gd:etag) 是不是我或谷歌只是在没有通知我们的情况下改变了架构?

P.S。对不起英语不好,并提前感谢您的帮助

1 个答案:

答案 0 :(得分:1)

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

在添加标题之前,feed和entry元素都没有指定的ETag。

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