百度空间 | 百度首页 
 
查看文章
 
metaWeblog API 学习笔记
2005-05-09 02:25

metaWeblog API 学习笔记



metaWeblog.newPost (blogid, username, password, struct) returns struct



The blogid, username and password params are as in the Blogger API.

blog,username,password参数都是blogger API中含有的。

The struct must contain at least three elements, name, type and bits.

struct必须含有至少三个参数:name,type,bits。

name is a string, it may be used to determine the name of the file that stores the object, or to display it in a list of objects. It determines how the weblog refers to the object. If the name is the same as an existing object stored in the weblog, it may replace the existing object.

name是一个字符串,它是用来决定存储对象的文件名或者显示在对象列表中。它还决定了对象和weblog的关联,如果存储在weblog中的对象的名字和给定的名字重复,它会替代存在的对象。

type is a string, it indicates the type of the object, it's a standard MIME type, like audio/mpeg or image/jpeg or video/quicktime.

type是一个字符串,它标识了对象的类型,是一个标准的MIME类型,如:audio/mpeg, image/jpeg, video/quicktime

bits is a base64-encoded binary value containing the content of the object.

bits是一个把内容经过base64编码后的二进制值。

The struct may contain other elements, which may or may not be stored by the content management system.

struct可能含有其他元素,这些非必要的元素是内容管理系统提供的。

If newMediaObject fails, it throws an error. If it succeeds, it returns a struct, which must contain at least one element, url, which is the url through which the object can be accessed. It must be either an FTP or HTTP url.

如果newMediaObject方法调用失败,它会抛出一个错误。如果调用成功,它返回一个struct,这个struct必须包含至少一个元素url,这个url是blog的url,必须是FTP或者HTTP协议。



Basic entry-points



There are three basic entry-points in the API:

新建一个blog

metaWeblog.newPost (blogid, username, password, struct, publish) returns string

编辑一个blog

metaWeblog.editPost (postid, username, password, struct, publish) returns true

得到blog

metaWeblog.getPost (postid, username, password) returns struct

注册用户

metaWeblog.registerUser(username, password, email, useragent, contactinfo) returns string

The return value is the blogid of the new weblog (if successful) or "false" otherwise. The useragent argument is optional; it identifies the software used. The contactinfo argument is a struct containing optional contact information for the user (as strings): name, streetaddress1, streetaddress2, city, state, zip, phone, fax, alternateemail.







The struct



In newPost and editPost, content is not a string, as it is in the Blogger API, it's a struct. The defined members of struct are the elements of <item> in RSS 2.0, providing a rich variety of item-level metadata, with well-understood applications.

在newPost和editPost方法中,内容不再是Blogger API中那样的字符串了。struct节点的成员member是RSS2.0定义的item节点的elements元素。

The three basic elements are title, link and description. For blogging tools that don't support titles and links, the description element holds what the Blogger API refers to as "content."

title,link和description三个基本节点是必须包含的。

可能的子节点列表

Element Description Example

title The title of the item. Venice Film Festival Tries to Quit Sinking

link The URL of the item. ::URL::http://www.nytimes.com/2002/09/07/movies/07FEST.html

description The item synopsis.

author Email address of the author of the item. More. oprah@oxygen.net

category Includes the item in one or more categories. More. Simpsons Characters

comments URL of a page for comments relating to the item.

enclosure Describes a media object that is attached to the item. More.

guid A string that uniquely identifies the item. More. ::URL::http://inessential.com/2002/09/01.php#a2

pubDate Indicates when the item was published. More. Sun, 19 May 2002 15:21:36 GMT

source The RSS channel that the item came from. More. Quotes of the Day



2004-12-26

准备做一个html页面,调用微软的xml控件发送接收xml文件,测试mt的xml-rpc到底反馈的是什么东西。


类别:计算机与 internet | | 添加到搜藏 | 分享到i贴吧 | 浏览() | 评论 (1)
 
最近读者:
 
网友评论:
1
2009-04-13 15:54 | 回复
...
 
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2010 Baidu