轉自:[url]http://blog.csdn.net/phphot/archive/2007/11/02/1863764.aspx[/url]
轉自:[url]http://hi.baidu.com/pleasure8/blog/item/35ab26fa6324609659ee9006.html[/url]
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規範中裡面的定義。的定義如下:
元素 | 說明 | 例子 |
title | The title of the item. | Venice Film Festival Tries to Quit Sinking |
link | The URL of the item. | [url]http://nytimes.com/2004/12/07FEST.html[/url] |
description | The 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. |
author | Email address of the author of the item | |
category | Includes the item in one or more categories | |
comments | URL of a page for comments relating to the item | |
enclosure | Describes a media object that is attached to the item | |
guid | A string that uniquely identifies the item. | |
pubDate | Indicates when the item was published. | |
source | The 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 、p_w_picpath/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來顯示錯誤。
——————————————————————————————————————————
其他有用的網站(轉自[url]http://blog.csdn.net/zhaoweiwww/archive/2006/11/27/1416763.aspx[/url]):
[url]http://www.xmlrpc.com/[/url] 最權威的站,介紹了什麼是xml-rpc,規範,實作的語言,mail list
[url]http://www.xmlrpc.com/spec[/url] 英文的xml-rpc規範
RFC: MetaWeblog API MetaWeblog API 規範
[url]http://www.duduwolf.com/post/41.asp[/url] 中文翻譯的xml-rpc規範(感謝翻譯者:滴水)
[url]http://www.XML-RPC.Net[/url] XML-RPC的.NET 實作,其中有最新.net2.0的XML-RPC實作的下載下傳
MetaWeblogAPI and MSN Spaces MSDN上關于MetaWeblog API及MSN Spaces接口的說明及.NET示例