有趣吧公开的一个api,详解与实例

有趣吧公开的一个api介绍

显示有趣新鲜事

路径:http://www.youqubar.com/api/status_[json|xml|rss]
参数
count(可选)-记录数,范围1-20,默认为20.
示例:http://www.youqubar.com/api/status_rss?count=10
callback(可选)-javascript函数名,使用JSON格式时可用,将JSON对象作为参数直接调用
示例:http://www.youqubar.com/api/status_rss?callback=getStatuses

现有应用举例
“海内存知己,天涯共有趣”
地址:http://www.youqubar.com/lab/gongyouqu
通过查看网页源代码找到唯一我们写的代码:http://www.youqubar.com/javascripts/map.js
地图、地理解码均来自第三方数据及应用
调用api方式:http://www.youqubar.com/api/status_json?count=2&callback=YOUQU.callBack

返回:
YOUQU.callBack([
{'created_at':'约21小时前','id': 'Mike','text':'加入有趣吧',
'user':{'upic':'http: //www.youqubar.com/images/tool/friend.gif','uurl':'http://www.youqubar.com/user/show/364','name':'Mike',
'location':'湖北武汉','description':'','profile_image_url':'http://www.youqubar.com/ /upload//pictures//2007//8//23//224152962288_l.jpg',
'url':'http://www.youqubar.com/user/show/364', 'protected':false}},
{'created_at':'3天前','id':'小会','text':'登录有趣吧',
'user': {'upic':'http://www.youqubar.com/images/tool/friend.gif','uurl':'http://www.youqubar.com/user/show/88', 'name':'小会',
'location':'湖北襄樊','description':'','profile_image_url':'http://www.youqubar.com/ /newimages//nophoto_l.jpg',
'url':'http://www.youqubar.com/user/show/88','protected':false}}
]);

“三生万物,万物有趣”
地址:http://www.youqubar.com/lab/wanwu
调用api方式:http://www.youqubar.com/api/status_json?count=2&callback=render
原理同上
返回:
render([
{'created_at':'约21小时前','id': 'Mike','text':'加入有趣吧',
'user':{'upic':'http: //www.youqubar.com/images/tool/friend.gif','uurl':'http://www.youqubar.com/user/show/364','name':'Mike',
'location':'湖北武汉','description':'','profile_image_url':'http://www.youqubar.com/ /upload//pictures//2007//8//23//224152962288_l.jpg',
'url':'http://www.youqubar.com/user/show/364', 'protected':false}},
{'created_at':'3天前','id':'小会','text':'登录有趣吧',
'user': {'upic':'http://www.youqubar.com/images/tool/friend.gif','uurl':'http://www.youqubar.com/user/show/88', 'name':'小会',
'location':'湖北襄樊','description':'','profile_image_url':'http://www.youqubar.com/ /newimages//nophoto_l.jpg',
'url':'http://www.youqubar.com/user/show/88','protected':false}}
]);
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值