|
这篇文章是使用BBuddy工具编辑和发布的。 (BlogBuddy为开源软件 ,感谢 chnwin的辛勤工作,目前下载的为中文版本。) 使用BBuddy这样的工具编辑和发布Blog是很方便的,现在也有很多这样的工具,但是他们的 原理都是使用了blog系统的xml-rpc接口。连接时需要如下参数: - 你在这个blog上登陆的用户名和密码:我就是crackpot和xxxxxxxx;
- 还有这个blog登陆页面的地址和端口,CU的就是:blog.chinaunix.net,端口:80;
- 然后还需要这个blog系统的xml-rpc所在的path,CU的blog系统是Plog,它的XML的路径
是xmlrpc.php,对CU来说就是:/xmlrpc.php 这样,就可以在本地看到你的blog,同时方便的进行编辑,管理和发布。 下面是XML-API的介绍(转自 竹笋炒肉),CU的强人们完全可以自己作出一个自己的工具来。 BloggerAPI based on XML-RPC 1、方法列表
| 方法 | 说明 | | blogger.newPost | 向批定的blog增加新的文章(post),通常会在增加后即发布。 | | blogger.editPost | 编辑一篇文章(post),通常会在修改后发布。 | | blogger.getUsersBlogs | 返回一个成员的所有文章的信息。 | | blogger.getUserInfo | 鉴证一个用户并反回其信息(如userid,email等) | | blogger.getTemplate | 返回指定的blog的主要或文档索引模板 | | blogger.setTemplate | 编辑指定的blog的主要或文档索引模板 |
2、blogger.newPost 参数说明
| 参数 | 说明 | | appkey (string) | 发送这个post的程序的唯一标志 | | blogid (string) | 这个post即将发送到的blog的标志 | | username (string) | 有权post文章的用户名 | | password (string) | 用户密码 | | content (string) | Post的内容 | | publish (boolean) | 是否发布 |
示例: 请求XML-RPC调用的数据
POST /api/RPC2 HTTP/1.0 User-Agent: Java.Net Wa-Wa 2.0 Host: plant.blogger.com Content-Type: text/xml Content-length: 515
blogger.newPost
C6CE3FFB3174106584CBB250C0B0519BF4E294 744145 ewilliams secret Today I had a peanut butter and pickle sandwich for lunch. Do you like peanut-butter and pickle sandwiches? I do. They're yummy. Please comment! false
成功时的应答
HTTP/1.1 200 OK Connection: close Content-Length: 125 Content-Type: text/xml Date: Mon, 6 Aug 20001 19:55:08 GMT Server: Java.Net Wa-Wa/Linux
4515151
失败时的应答
错误信息通过XML-RPC 及 项返回,包含着的 有错误码和描述,这是由xml-rpc规范定义. HTTP/1.1 200 OK Connection: close Content-Length: 225 Content-Type: text/xml Date: Mon, 6 Aug 20001 19:55:08 GMT Server: Java.Net Wa-Wa/Linux
faultCode 4
faultString java.lang.Exception: java.lang.Exception: Error: AppKey is invalid or inactive.
3、blogger.editPost 参数说明
| 参数 | 说明 | | appkey (string) | 发送这个post的程序的唯一标志 | | postid (string) | 某篇post的唯一标志 | | username (string) | 有权修改文章的用户名(作者或管理员) | | password (string) | 用户密码 | | content (string) | Post的内容 | | publish (boolean) | 是否发布 |
4、blogger.getUserBlogs 参数说明
| 参数 | 说明 | | appkey (string) | 发送这个post的程序的唯一标志 | | username (string) | 用户名 | | password (string) | 用户密码 |
成功应答示例
HTTP/1.1 200 OK Connection: close Content-Length: 125 Content-Type: text/xml Date: Mon, 6 Aug 20001 19:55:08 GMT Server: Java.Net Wa-Wa/Linux
url http://stuff.foo.com/biz
blogid 2997323
blogName Blogger Biz Dev
url http://www.blogger.com/
blogid 2723
blogName Blogger News
url http://www.geocities.com/rafting/
blogid 223723
blogName RaftingBlog
5、blogger.getUserInfo 参数说明
| 参数 | 说明 | | appkey (string) | 发送这个post的程序的唯一标志 | | username (string) | 用户名 | | password (string) | 用户密码 |
成功应答示例
HTTP/1.1 200 OK Connection: close Content-Length: 125 Content-Type: text/xml Date: Mon, 6 Aug 20001 19:55:08 GMT Server: Java.Net Wa-Wa/Linux
nickname Ev.
userid 1
url http://www.evhead.com
email ev@pyra.com
lastname Williams
firstname Evan
6、blogger.getTemplate 参数说明
| 参数 | 说明 | | appkey (string) | 发送这个post的程序的唯一标志 | | blogid (string) | 这个post即将发送到的blog的标志 | | username (string) | 有权post文章的用户名 | | password (string) | 用户密码 | | templateType (string) | 指定返回哪个模板,目前只能是 "main" 或 "archiveIndex". |
成功时的应答,....表示此处内容被我省略。
<
<$BlogDateHeaderDate$><$BlogItemBody$>
main
|