微博开放平台
微连接
移动应用
网站接入
电商服务商
电商商家
数据服务
数据服务
合作伙伴
微博支付
轻应用
粉丝服务
文档
推广
我的应用
登录
weibo
开发文档
首页
平台政策与指引
概述
平台公约
新手指南
开发者协议
应用运营管理规范
微连接分级管理办法
应用审核产品指南
应用安全开发注意事项
平台应用设计规范
微服务接入指南
微博登录接入
用微博帐号登录
授权机制
移动应用接入
移动应用介绍
移动应用SSO授权
微博Deep Link
媒体接入平台
头条文章开放接口
视频上传开放接口
电商接入平台
电商服务商接入
电商商家端接入
电商平台能力接口
粉丝服务平台
粉丝服务平台
新手接入指南
微信开发者迁移指南
接收消息
发送消息
自定义菜单
用户管理
生成带参数的二维码
Fans Service Platform
商业接口
商业数据接入指南
订阅服务手册(中文版)
订阅服务手册(英文版)
商业接口-REST API
商业数据常见问题
网站接入
网站接入介绍
微博API
微博API
接口访问频次权限
资源下载
SDK
微博标识下载
常见问题
联系我们
工具箱
链入页面
链出更改
特殊页面
查看源代码
跳转到:
导航
,
搜索
根据下列原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
{{api_desc2| uri=statuses/friends| desc=获取用户关注列表及每个关注用户的最新一条微博,返回结果按关注时间倒序排列,最新关注的用户排在最前面。| format=XML/JSON| httpMethod=GET| needAuth=true| rateLimit=true| params={{api_args|:id|false|int64/string|用户ID(int64)或者昵称(string)。该参数为一个REST风格参数。调用示例见注意事项}} {{api_args|user_id|false|int64|用户ID,主要是用来区分用户ID跟微博昵称。当微博昵称为数字导致和用户ID产生歧义,特别是当微博昵称和用户ID一样的时候,建议使用该参数}} {{api_args|screen_name|false|string|微博昵称,主要是用来区分用户UID跟微博昵称,当二者一样而产生歧义的时候,建议使用该参数}} {{api_args|cursor|false|int|用于分页请求,请求第1页cursor传-1,在返回的结果中会得到next_cursor字段,表示下一页的cursor。next_cursor为0表示已经到记录末尾。}} {{api_args|count|false|int,默认20,最大200|每页返回的最大记录数,最大不能超过200,默认为20。}} {{api_args_colspan|1=<font style="color:#ee3333">:id, user_id, screen_name 可以任选一个参数,在3个都不提供的情况下,系统返回当前登录用户的关注列表</font>}}| getParam=&user_id=11051| postParam=| result= ===XML示例=== <pre> <?xml version="1.0" encoding="UTF-8"?> <users> <user> <id>1473612611</id> <screen_name>周立清</screen_name> <name>周立清</name> <province>14</province> <city>1</city> <location>山西 太原</location> <description>新浪微博开放平台(open.t.sina.com.cn),欢迎广大站长朋友前来聊聊:13718188488 、 010-62676120 、QQ:3653550、liqing3@staff.sina.com.cn</description> <url>http://www.linger.cn</url> <profile_image_url>http://tp4.sinaimg.cn/1473612611/50/1284048157/1</profile_image_url> <domain>xyzlinger</domain> <gender>m</gender> <followers_count>4652</followers_count> <friends_count>1060</friends_count> <statuses_count>3897</statuses_count> <favourites_count>5</favourites_count> <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at> <following>false</following> <verified>true</verified> <allow_all_act_msg>true</allow_all_act_msg> <geo_enabled>true</geo_enabled> <remark/> <status> <created_at>Fri Dec 03 13:49:07 +0800 2010</created_at> <id>4051881415</id> <text>哈哈,看到新浪@微博大屏幕 了[哈哈],第一条是@飞象网项立刚 的微博,给力![good]</text> <source> <a href="http://t.sina.com.cn">新浪微博</a> </source> <favorited>false</favorited> <truncated>false</truncated> <geo/> <in_reply_to_status_id/> <in_reply_to_user_id/> <in_reply_to_screen_name/> <retweeted_status> <created_at>Fri Dec 03 13:45:02 +0800 2010</created_at> <id>4051797049</id> <text>#3G创新应用#工信部电信研究院通信信息所所长徐玉正在演讲,数据很详实,人也很漂亮。</text> <source> <a href="http://t.sina.com.cn/mobile/msg.php">彩信</a> </source> <favorited>false</favorited> <truncated>false</truncated> <geo/> <in_reply_to_status_id/> <in_reply_to_user_id/> <in_reply_to_screen_name/> <thumbnail_pic>http://ww3.sinaimg.cn/thumbnail/4c1526eajw6dbzdl54fmoj.jpg</thumbnail_pic> <bmiddle_pic>http://ww3.sinaimg.cn/bmiddle/4c1526eajw6dbzdl54fmoj.jpg</bmiddle_pic> <original_pic>http://ww3.sinaimg.cn/large/4c1526eajw6dbzdl54fmoj.jpg</original_pic> <user> <id>1276454634</id> <screen_name>孙慧飞象</screen_name> <name>孙慧飞象</name> <province>11</province> <city>5</city> <location>北京 朝阳区</location> <description>远树两行山倒影,轻舟一叶水平流</description> <url>http://blog.sina.com.cn/sunhuiblog</url> <profile_image_url>http://tp3.sinaimg.cn/1276454634/50/1283155247/0</profile_image_url> <domain>sunhui123</domain> <gender>f</gender> <followers_count>871</followers_count> <friends_count>314</friends_count> <statuses_count>552</statuses_count> <favourites_count>4</favourites_count> <created_at>Fri Oct 16 00:00:00 +0800 2009</created_at> <following>false</following> <verified>true</verified> <allow_all_act_msg>true</allow_all_act_msg> <geo_enabled>true</geo_enabled> </user> <annotations/> </retweeted_status> <annotations/> </status> </user> ... <next_cursor>1</next_cursor> <previous_cursor>0</previous_cursor> </users> </pre> ===JSON示例=== <pre> { "users" : [ { "name" : "周立清", "domain" : "xyzlinger", "geo_enabled" : true, "followers_count" : 4652, "statuses_count" : 3897, "favourites_count" : 5, "city" : "1", "description" : "新浪微博开放平台(open.t.sina.com.cn),欢迎广大站长朋友前来聊聊:13718188488 、 010-62676120 、QQ:3653550、liqing3@staff.sina.com.cn", "verified" : true, "remark" : "", "status" : { "created_at" : "Fri Dec 03 13:49:07 +0800 2010", "text" : "哈哈,看到新浪@微博大屏幕 了[哈哈],第一条是@飞象网项立刚 的微博,给力![good]", "truncated" : false, "retweeted_status" : { "created_at" : "Fri Dec 03 13:45:02 +0800 2010", "text" : "#3G创新应用#工信部电信研究院通信信息所所长徐玉正在演讲,数据很详实,人也很漂亮。", "bmiddle_pic" : "http://ww3.sinaimg.cn/bmiddle/4c1526eajw6dbzdl54fmoj.jpg", "original_pic" : "http://ww3.sinaimg.cn/large/4c1526eajw6dbzdl54fmoj.jpg", "truncated" : false, "in_reply_to_status_id" : "", "annotations" : [ ], "in_reply_to_screen_name" : "", "geo" : null, "user" : { "name" : "孙慧飞象", "domain" : "sunhui123", "geo_enabled" : true, "followers_count" : 871, "statuses_count" : 552, "favourites_count" : 4, "city" : "5", "description" : "远树两行山倒影,轻舟一叶水平流", "verified" : true, "id" : 1276454634, "gender" : "f", "friends_count" : 314, "screen_name" : "孙慧飞象", "allow_all_act_msg" : true, "following" : false, "url" : "http://blog.sina.com.cn/sunhuiblog", "profile_image_url" : "http://tp3.sinaimg.cn/1276454634/50/1283155247/0", "created_at" : "Fri Oct 16 00:00:00 +0800 2009", "province" : "11", "location" : "北京 朝阳区" }, "favorited" : false, "thumbnail_pic" : "http://ww3.sinaimg.cn/thumbnail/4c1526eajw6dbzdl54fmoj.jpg", "in_reply_to_user_id" : "", "id" : 4051797049, "source" : "<a href=\"http://t.sina.com.cn/mobile/msg.php\" rel=\"nofollow\">彩信</a>" }, "in_reply_to_status_id" : "", "annotations" : [ ], "in_reply_to_screen_name" : "", "geo" : null, "favorited" : false, "in_reply_to_user_id" : "", "id" : 4051881415, "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>" }, "id" : 1473612611, "gender" : "m", "friends_count" : 1060, "screen_name" : "周立清", "allow_all_act_msg" : true, "following" : false, "url" : "http://www.linger.cn", "profile_image_url" : "http://tp4.sinaimg.cn/1473612611/50/1284048157/1", "created_at" : "Fri Aug 28 00:00:00 +0800 2009", "province" : "14", "location" : "山西 太原" }, ... ], "next_cursor" : 1, "previous_cursor" : 0 } </pre> {{param_user}} {{param_status}}| useAge= * :id为REST风格的参数,使用该参数的URL为:<br/> http://api.t.sina.com.cn/statuses/friends/:id.format <br/> 使用示例如下:<br/> http://api.t.sina.com.cn/statuses/friends/11051.xml?source=appkey<br/>http://api.t.sina.com.cn/statuses/friends/timyang.json?source=appkey * 如果没有提供cursor参数,将只返回最前面的20个关注用户。| otherInfo= ===Java示例=== 请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br> 代码示例如下: package weibo4j.examples; import java.util.List; import weibo4j.Weibo; import weibo4j.User; public class GetFriends { /** * Usage: java -DWeibo4j.oauth.consumerKey=[consumer key] -DWeibo4j.oauth.consumerSecret= [consumer secret] Weibo4j.examples.GetFriends [accessToken] [accessSecret] * @param args message */ public static void main(String[] args) { try { System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY); System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET); Weibo weibo = new Weibo(); weibo.setToken(args[0], args[1]); try { List<User> list= weibo.getFriendsStatuses(); System.out.println("Successfully get Friends to [" + list + "]."); } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } System.exit(0); } catch (Exception ioe) { System.out.println("Failed to read the system input."); System.exit( -1); } } } ===PHP示例=== 请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br> 代码示例如下: <pre> //Statuses/friends $c = new WeiboClient( WB_AKEY , WB_SKEY , $_SESSION['last_key']['oauth_token'] , $_SESSION['last_key']['oauth_token_secret'] ); //用户ID $u_id = "User_ID"; $msg = $c->friends(false, false, $u_id); if ($msg === false || $msg === null){ echo "Error occured"; return false; } if (isset($msg['error_code']) && isset($msg['error'])){ echo ('Error_code: '.$msg['error_code'].'; Error: '.$msg['error'] ); return false; } foreach($msg as $friend){ echo($friend['id'].' : '.$friend['name'].' '.$friend['created_at'].' ;'); } </pre> }}
该页面使用的模板:
模板:Api args
(
查看源代码
)
模板:Api args colspan
(
查看源代码
)
模板:Api desc2
(
查看源代码
)
模板:Param status
(
查看源代码
)
模板:Param user
(
查看源代码
)
返回到
Statuses/friends
。
反馈
分享
顶部