MetaWeblog API中文说明

本文详细介绍了MetaWeblog API的用途、基本函数规范,包括newPost、editPost、getPost等,以及如何处理media对象和获取博客类别。此外,还提到了MetaWeblog API与MSN Spaces的接口示例和相关资源链接。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

    最近用了下MicroSoft的Windows Live Writer,确实很方便。但是总不能为了用这个客户端而放弃使用自己的blog吧,所以我找来了一些资料来研究,准备为我的blog实现这个接口。

    转自:http://hi.baidu.com/pleasure8/blog/item/35ab26fa6324609659ee9006.html

MetaWeblog API中文说明

1、什么是MetaWeblog?

MetaWebBlog API(MWA)是一个Blog程序接口标准,允许外部程序来获取或者设置Blog的文字和熟悉。他建立在XMLRPC接口之上,并且已经有了很多的实现。

2、基本的函数规范

有三个基本的函数规范:

metaWeblog.newPost (blogid, username, password, struct, publish) 返回一个字符串,可能是Blog的ID。
metaWeblog.editPost (postid, username, password, struct, publish) 返回一个Boolean值,代表是否修改成功。
metaWeblog.getPost (postid, username, password) 返回一个Struct。

其中blogid、username、password分别代表Blog的id(注释:如果你有两个Blog,blogid指定你需要编辑的blog)、用户名和密码。

struct的含意:

在newPost和editPost中,struct是一个RSS 2.0规范中 里面的定义。 的定义如下:

元素说明例子
titleThe title of the item.Venice Film Festival Tries to Quit Sinking
linkThe URL of the item.http://nytimes.com/2004/12/07FEST.html
descriptionThe item synopsis.Some of the most heated chatter at the Venice Film Festival this week was about the way that the arrival of the stars at the Palazzo del Cinema was being staged.
authorEmail address of the author of the item 
categoryIncludes the item in one or more categories 
commentsURL of a page for comments relating to the item 
enclosureDescribes a media object that is attached to the item 
guidA string that uniquely identifies the item. 
pubDateIndicates when the item was published. 
sourceThe RSS channel that the item came from. 

其中最主要的三个元素是title、link和description。如果Blog工具不支持title和link,description就是目录(Content)。category是一个数组,是这个Post所属的类别。如果类别不存在,服务器端将只处理存在的类别。

3、metaWeblog.newMediaObject

metaWeblog.newMediaObject (blogid, username, password, struct) 返回一个数组

其中blogid、username、password分别代表Blog的id(注释:如果你有两个Blog,blogid指定你需要编辑的blog)、用户名和密码。struct必须包含name, type 和bits三个元素,当然也可以包含其他元素。

name代表数据的名称,type是数据的MIME类型,譬如audio/mpeg 、image/jpeg和video/quicktime。bits是数据的base64编码形式的数据流。

如果调用失败,它显示错误信息。如果调用成功,返回值是一个Struct,里面至少包含一个Url元素,代表数据的HTTP或者FTP Url。

4、metaWeblog.getCategories

metaWeblog.getCategories (blogid, username, password) 返回一个struct。

返回值包含所有的Blog的类别,每一个列别包含description, htmlUrl and rssUrl。

5、metaWeblog.getRecentPosts

metaWeblog.getRecentPosts (blogid, username, password, numberOfPosts) 返回一个结构(struct)的数组(array)。

每一个Struct包含getPost返回值一样的结构。

numberOfPosts是返回的数量。

6、调用验证和错误显示

同Blogger API不同的是,metaWeblog没有APPKEY这个概念,你可以自己设置。

同时建议使用标准的XMLRPC Fault来显示错误。

——————————————————————————————————————————

其他有用的网站(转自http://blog.csdn.net/zhaoweiwww/archive/2006/11/27/1416763.aspx):

http://www.xmlrpc.com/  最权威的站,介绍了什么是xml-rpc,规范,实现的语言,mail list
http://www.xmlrpc.com/spec   英文的xml-rpc规范
RFC: MetaWeblog API   MetaWeblog API 规范
http://www.duduwolf.com/post/41.asp  中文翻译的xml-rpc规范(感谢翻译者:滴水)
http://www.XML-RPC.Net XML-RPC的.NET 实现,其中有最新.net2.0的XML-RPC实现的下载
MetaWeblogAPI and MSN Spaces  MSDN上关于MetaWeblog API及MSN Spaces接口的说明及.NET示例

 
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值