参考指南

重要提示:这是此页面的旧版本。如需使用最新版本,请使用左侧导航栏中的链接。

本文档提供了原始协议的详细参考文档。 (XML 和 HTTP)。

本文档不包含有关编程语言客户端库的信息。有关客户端库参考信息,请参阅 开发者指南中针对编程语言的部分。

目录

受众群体

本文档适用于想要编写可与 Blogger 交互的客户端应用的程序员。

本文档是参考文档;学习本课程的前提是,您已经了解 开发者指南中所述,以及 Google 数据 API 背后的一般理念 协议

Blogger Feed 类型

Blogger 在 Feed 中提供两种博客内容表示形式:完整 Feed 和摘要 Feed。完整 Feed 包含完整的博文,而摘要 Feed 仅包含每篇博文的简短摘要。

博客拥有者可以使用 GUI 设置指定博客是否提供 向整合商和集合商家提供完整 Feed 或摘要 Feed。

当您的客户端应用针对 Feed 发送未经身份验证的请求时,它会收到 博客所有者指定的 Feed 类型。

但是,当客户端应用发送经过身份验证的请求时,始终 会收到完整的 Feed,无论博客的拥有者指定了什么。

Blogger 查询参数参考

Blogger 数据 API 支持几乎所有标准 Google Data API 查询参数

Blogger 不支持 q(文本搜索)和 author 参数。

updated-minupdated-max 查询参数 会被忽略,除非 orderby 参数设置为 updated。例如,下面的网址将检索 从 2008 年 3 月 16 日更新至 2008 年 3 月 24 日的帖子:

http://www.blogger.com/feeds/blogID/posts/default?updated-min=2008-03-16T00:00:00&updated-max=2008-03-24T23:59:59&orderby=updated

Blogger 元素参考

Blogger Data API 仅使用标准 Atom 元素;如需了解详情,请参阅 Atom 1.0 联合发布格式规范Atom 发布协议

本部分的剩余部分提供了有关 Blogger 的 使用某些标准元素。

草稿条目

博文条目的草稿使用 Atom Publishing Protocol 文档中定义的 <app:draft> 扩展元素进行标记。这里有 草稿评注示例:

<entry xmlns:app='http://purl.org/atom/app#'>
...
<app:control>
<app:draft>yes</app:draft>
</app:control>
</entry>

如果未指定 <draft> 元素,则不指定该条目 草稿。

出版日期和更新日期

以标准 Atom <published> 形式指定的时间戳 元素对应于“post date”用户可在 Blogger GUI。

当客户端创建新条目时,如果客户端未为 <published> 指定值,则 Blogger 会将条目的发布日期设为当前服务器时间。如果您的客户修改了一个条目,但未指定 <published> 值,Blogger 会离开该条目的发布日期 。

不过,如果您的客户在创建或修改条目时为 <published> 元素指定了值,Blogger 会将条目的发布日期设置为指定的值。这对于从其他博客系统导入旧条目(同时保留原始创建日期)等任务非常有用。

Blogger 使用标准 Atom <updated> 元素来指明条目的上次更改时间。您的客户端无法控制 <updated> 值;每当您的客户端发布或修改条目时,Blogger 始终会将条目的上次更新日期设置为当前服务器时间。

您可以使用标准 Google Data API published-minpublished-maxupdated-minupdated-max 查询参数,用于根据其 <published><updated> 值。不过, 有关查询更新日期的注意事项,请参阅 Blogger 查询参数参考

将评论与帖子相关联

Blogger 导出 format 在一个 Atom Feed 文档中同时包含帖子和评论条目。 为了区分这两种条目,Blogger 使用了 <atom:category> 元素。此元素将包含一个 term 参数,用于反映条目是针对帖子还是评论。

此外,将评论条目链接到其所属的帖子条目 (通过使用 Atom Threading Extension 实现)。在以下示例中,评论条目中的 <thr:in-reply-to> 元素将使用 ref 参数中的帖子条目标识符指向帖子。它还会通过 href 参数链接到帖子的 HTML 网址。

<feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
      xmlns:thr="http://purl.org/syndication/thread/1.0">
  ...

  <-- A blog post entry -->
  <entry>
    <id>tag:blogger.com,1999:blog-blogID.post-postID</id>
    <content type="html">This is my first post</content>
    <link rel="alternate" type="text/html"
      href="http://blogName.blogspot.com/2007/04/first-post.html">
    </link>
    <category scheme="http://schemas.google.com/g/2005#kind" 
              term="http://schemas.google.com/blogger/2008/kind#post"/>
    ...
  </entry>

  <-- A comment to the blog post entry -->
  <entry>
    <id>tag:blogger.com,1999:blog-blogID.post-postID.comment-commentID</id>
    <content type="html">This is my first commment</content>
    <category scheme="http://schemas.google.com/g/2005#kind" 
              term="http://schemas.google.com/blogger/2008/kind#comment"/>
    <thr:in-reply-to href="http://blogName.blogspot.com/2007/04/first-post.html" 
                     ref="tag:blogger.com,1999:blog-blogID.post-postID" 
                     type="text/html"/>
    ...
  </entry>
</feed>

返回页首