|
ApiDocumentation
饭否 API 文档
API更新记录2009-06-20
2009-05-20
基本概念用户验证如需要验证用户,验证方式为 HTTP Basic 验证。 用户 id用户 id 在个人网址中,例如:http://fanfou.com/fanfou 蓝色的部分即为用户 id。 使用 API 的简单途径如果你的系统中有 cURL,就可以通过非常简单的方式使用这些API了。 示例:
curl http://api.fanfou.com/statuses/public_timeline.rss
curl -u loginname:password http://api.fanfou.com/statuses/user_timeline.rss
curl -u loginname:password http://api.fanfou.com/statuses/friends_timeline.rss
curl -u loginname:password -d status="消息内容" http://api.fanfou.com/statuses/update.xml API应用认证通过认证的应用,在每条消息后会有 '通过 YOUR_APP_NAME' 的信息,YOUR_APP_NAME是你的应用名,并链接到应用的发布网址。 你的应用希望通过认证?请:
说明:
API 方法说明消息相关的方法显示随便看看的消息路径: http://api.fanfou.com/statuses/public_timeline.[json|xml|rss] 参数:
示例: http://api.fanfou.com/statuses/public_timeline.rss?count=10
示例: http://api.fanfou.com/statuses/public_timeline.json?callback=getStatuses 显示用户和好友的消息路径: http://api.fanfou.com/statuses/friends_timeline.[json|xml|rss] 参数:
示例: http://api.fanfou.com/statuses/friends_timeline.rss?id=fanfou
示例: http://api.fanfou.com/statuses/friends_timeline.rss?count=10
示例: http://api.fanfou.com/statuses/friends_timeline.xml?since_id=6IAZmgy1TzA
示例: http://api.fanfou.com/statuses/friends_timeline.xml?max_id=6IAZmgy1TzA
示例: http://api.fanfou.com/statuses/friends_timeline.json?page=3
示例: http://api.fanfou.com/statuses/friends_timeline.json?callback=getStatuses 显示用户的消息路径: http://api.fanfou.com/statuses/user_timeline.[json|xml|rss] 参数:
示例: http://api.fanfou.com/statuses/user_timeline.rss?id=fanfou 或 http://api.fanfou.com/statuses/user_timeline/fanfou.rss
示例: http://api.fanfou.com/statuses/user_timeline.rss?count=10
示例: http://api.fanfou.com/statuses/user_timeline.xml?since_id=6IAZmgy1TzA1
示例: http://api.fanfou.com/statuses/user_timeline.xml?max_id=6IAZmgy1TzA
示例: http://api.fanfou.com/statuses/user_timeline.json?page=3
示例: http://api.fanfou.com/statuses/user_timeline.json?callback=getStatuses 显示指定消息路径: http://api.fanfou.com/statuses/show/id.[json|xml|rss] 参数:
示例: http://api.fanfou.com/statuses/show/6IAZmgy1TzA.xml 显示发给当前用户的消息路径: http://api.fanfou.com/statuses/replies.[json|xml|rss] 参数:
示例: http://api.fanfou.com/statuses/replies.rss?count=10
示例: http://api.fanfou.com/statuses/replies.xml?since_id=6IAZmgy1TzA
示例: http://api.fanfou.com/statuses/replies.xml?max_id=6IAZmgy1TzA
示例: http://api.fanfou.com/statuses/replies.json?page=3
发布消息路径: http://api.fanfou.com/statuses/update.[json|xml] 方法:POST 参数:
转发消息转发 实际上是发布一条新消息,使用的是发布消息接口,我们推荐的实现是:
删除消息路径: http://api.fanfou.com/statuses/destroy.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/statuses/destroy/6IAZmgy1TzA.xml 照片相关的方法New!饭否上传API模拟HTML的file input上传照片,也就是 HTTP POST 时 Content-Type 设置为 multipart/form-data。参考RFC1867 http://www.ietf.org/rfc/rfc1867.txt 照片上传路径:http://api.fanfou.com/photos/upload.[json|xml] 方法:POST 参数:
搜索相关的方法公开搜索路径:http://api.fanfou.com/search/public_timeline.[json|xml] 参数:
示例:http://api.fanfou.com/search/public_timeline.json?q=fanfou 或 http://api.fanfou.com/search/public_timeline/%E9%A5%AD%E5%90%A6.xml,这里 %E9%A5%AD%E5%90%A6 是饭否的UTF8编码。
示例: http://api.fanfou.com/search/public_timeline/fanfou.xml?max_id=6IAZmgy1TzA 热词New!返回当前的饭否热词。 路径:http://api.fanfou.com/trends.json 用户相关的方法显示好友列表路径: http://api.fanfou.com/users/friends.[json|xml] 参数:
示例: http://api.fanfou.com/users/friends.xml?id=fanfou 或 http://api.fanfou.com/users/friends/fanfou.xml
示例: http://api.fanfou.com/users/friends.json?page=3 显示关注者列表路径: http://api.fanfou.com/users/followers.[json|xml] 参数:
示例: http://api.fanfou.com/users/followers.xml?id=fanfou 或 http://api.fanfou.com/users/followers/fanfou.xml
示例: http://api.fanfou.com/users/followers.json?page=3 显示用户详细信息路径: http://api.fanfou.com/users/show.[json|xml] 参数:
示例: http://api.fanfou.com/users/show.xml?id=fanfou 或 http://api.fanfou.com/users/show/fanfou.xml 私信相关的方法显示用户收到的私信路径: http://api.fanfou.com/direct_messages.[json|xml|rss] 参数:
示例: http://api.fanfou.com/direct_messages.xml?count=10
示例: http://api.fanfou.com/direct_messages.xml?since_id=12345
示例: http://api.fanfou.com/direct_messages.xml?max_id=6IAZmgy1TzA
示例: http://api.fanfou.com/direct_messages.json?page=3 显示用户发的私信路径: http://api.fanfou.com/direct_messages/sent.[json|xml] 参数:
示例: http://api.fanfou.com/direct_messages/sent.xml?count=10
示例: http://api.fanfou.com/direct_messages/sent.xml?since_id=12345
示例: http://api.fanfou.com/direct_messages/sent.xml?max_id=6IAZmgy1TzA
示例: http://api.fanfou.com/direct_messages/sent.json?page=3 发送私信路径: http://api.fanfou.com/direct_messages/new.[json|xml] 方法:POST 参数:
删除私信路径: http://api.fanfou.com/direct_messages/destroy.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/direct_messages/destroy.xml?id=102 或 http://api.fanfou.com/direct_messages/destroy/102.xml 收藏相关的方法显示用户的收藏列表路径: http://api.fanfou.com/favorites.[json|xml|rss] 参数:
示例: http://api.fanfou.com/favorites/fanfou.rss 或 http://api.fanfou.com/favorites/fanfou.xml
示例: http://api.fanfou.com/favorites.xml?count=10 收藏某条消息路径: http://api.fanfou.com/favorites/create/id.[json|xml] 方法:POST 参数:
或 http://api.fanfou.com/favorites/create/VFL8jI1pl9c.xml 删除收藏路径: http://api.fanfou.com/favorites/destroy/id.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/favorites/destroy/VFL8jI1pl9c.json 或 http://api.fanfou.com/favorites/destroy/VFL8jI1pl9c.xml 好友关系方法添加好友路径: http://api.fanfou.com/friendships/create.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/friendships/create.xml?id=fanfou 或 http://api.fanfou.com/friendships/create/fanfou.xml 删除好友路径: http://api.fanfou.com/friendships/destroy.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/friendships/destroy.xml?id=fanfou 或 http://api.fanfou.com/friendships/destroy/fanfou.xml 判断好友关系是否存在New!路径: http://api.fanfou.com/friendships/exists.[json|xml] 参数:
示例: http://api.fanfou.com/friendships/exists.xml?user_a=fanfou&user_b=wanhuai 好友和关注者方法New!显示好友id列表路径: http://api.fanfou.com/friends/ids.[json|xml] 参数:
示例: http://api.fanfou.com/friends/ids/fanfou.xml 显示关注者id列表路径: http://api.fanfou.com/followers/ids.[json|xml] 参数:
示例: http://api.fanfou.com/followers/ids/fanfou.xml 好友消息通知方法New!打开通知路径: http://api.fanfou.com/notifications/follow.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/notifications/follow.xml?id=fanfou 或 http://api.fanfou.com/notifications/follow/fanfou.xml 关闭通知路径: http://api.fanfou.com/notifications/leave.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/notifications/leave.xml?id=fanfou 或 http://api.fanfou.com/notifications/leave/fanfou.xml 黑名单方法加入黑名单路径: http://api.fanfou.com/blocks/create.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/blocks/create.xml?id=fanfou 或 http://api.fanfou.com/blocks/create/fanfou.xml 解除黑名单路径: http://api.fanfou.com/blocks/destroy.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/blocks/destroy.xml?id=fanfou 或 http://api.fanfou.com/blocks/destroy/fanfou.xml 账号方法验证用户检验用户名密码是否正确 路径: http://api.fanfou.com/account/verify_credentials.[json|xml] 参数:无 保存搜索相关的方法New!显示登录用户的搜索保存列表路径: http://api.fanfou.com/saved_searches.[json|xml] 显示指定的搜索词路径: http://api.fanfou.com/saved_searches/show/id.[json|xml] 参数:
示例: http://api.fanfou.com/saved_searches/show/12345.xml 保存搜索词路径: http://api.fanfou.com/saved_searches/create.[json|xml] 方法:POST 参数:
删除搜索词路径: http://api.fanfou.com/saved_searches/destroy/id.[json|xml] 方法:POST 参数:
示例: http://api.fanfou.com/saved_searches/destroy/12345.json 或 http://api.fanfou.com/saved_searches/destroy/12345.xml 辅助方法测试API用指定格式返回一个 ok 值,返回的 HTTP code 为 200 路径: http://api.fanfou.com/help/test.[json|xml] 参数:无 返回的参数模块消息模块消息模块由消息的信息组成,其中用一个用户模块来描述消息的发起人 <status>
用户基本信息模块用户基本信息模块由用户的基本信息组成,其中用一个消息模块来描述此用户最新的一条消息 <user>
用户扩展信息模块用户扩展信息模块,较详细的表示了用户的各项信息。(以后还会继续补充) <user>
私信模块私信模块由私信的各项属性组成,其中由sender模块表示发信人信息,recipient模块表示收信人信息 <direct_message>
返回的参数属性值created_at描述: 元素的创建时间 示例: Fri Apr 10 12:59:35 +0000 2009 description描述: 用户的自述 示例: 默认值为空 favorited描述: 表示当前消息是否已被收藏 示例: true, false favorites_count描述: 当前用户的收藏数 示例: 0, 268 following描述: 表示被验证用户是否已经把当前用户加为好友了 示例: true, false followers_count描述: 当前用户的被关注数 示例: 0, 2013 friends_count描述: 当前用户的好友数 示例: 0, 801 name描述: 当前用户的昵称 示例: 饭否, 郭万怀 id描述: 元素的独立id 示例: 4L0aUggHfq8 (消息id), fanfou (用户id) in_reply_to_screen_name描述: 消息所回复的用户昵称 示例: (空值), 饭否 in_reply_to_status_id描述: 被回复的消息id 示例: (空值), 4L0aUggHfq8 in_reply_to_user_id描述: 消息所回复的用户id 示例: (空值), fanfou location描述: 用户的所在地 示例: 北京, 上海 notifications描述: 表示被验证的用户是否接收当前用户的消息通知 示例: true, false profile_image_url描述: 当前用户的头像地址 示例: protected描述: 表示当前用户是否设置了“需要我批准才能查看我的消息” 示例: true, false screen_name描述: 当前用户的昵称 示例: 饭否, 郭万怀 source描述: 消息的发布途径 示例: 网页, 手机上网 statuses_count描述: 当前用户的消息数 示例: 0, 2068 text描述: 消息的内容 示例: 饭否排行榜新增最新动态,可以看到刚刚给自己打过标签的人。 truncated描述: 表示当前消息是否需要截断 示例: true, false url描述: 用户个人信息中的网站地址 示例: http://dev.fanfou.com 意见反馈请访问饭否开发者论坛 |