MetaWeblog API中文說明

轉自:[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://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示例
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章