Statuses/friends

跳转到: 导航, 搜索
(statuses/friends)
 
(未显示1个用户的2个中间版本)
第1行: 第1行:
== statuses/friends ==
+
{{api_desc2|
获取用户关注列表及每个关注用户最新一条微博,返回结果按关注时间倒序排列,最新关注的用户在最前面。
+
uri=statuses/friends|
 
+
desc=获取用户关注列表及每个关注用户的最新一条微博,返回结果按关注时间倒序排列,最新关注的用户排在最前面。|
=== URL===
+
format=XML/JSON|
http://api.t.sina.com.cn/statuses/friends.format
+
httpMethod=GET|
+
needAuth=true|
=== 格式===
+
rateLimit=true|
XML, JSON
+
params={{api_args|:id|false|int64/string|用户ID(int64)或者昵称(string)。该参数为一个REST风格参数。调用示例见注意事项}}
 
+
{{api_args|user_id|false|int64|用户ID,主要是用来区分用户ID跟微博昵称。当微博昵称为数字导致和用户ID产生歧义,特别是当微博昵称和用户ID一样的时候,建议使用该参数}}
=== HTTP请求方式===
+
{{api_args|screen_name|false|string|微博昵称,主要是用来区分用户UID跟微博昵称,当二者一样而产生歧义的时候,建议使用该参数}}
GET
+
{{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>}}|
true
+
getParam=&user_id=11051|
 
+
postParam=|
=== 请求数限制===
+
result=
true
+
===XML示例===
 
+
=== 请求参数===
+
* id.  可选参数,用户uid 
+
# o 示例: http://api.t.sina.com.cn/statuses/friends/12345.json
+
# http://api.t.sina.com.cn/statuses/friends/12345.xml
+
* user_id.  可选参数.  用户uid, 和id作用相同。id和user_id任选一个
+
# o 示例: http://api.t.sina.com.cn/statuses/friends.xml?user_id=1401881
+
* screen_name.  可选参数,微博昵称
+
# o 示例: http://api.t.sina.com.cn/statuses/friends.xml?screen_name=101010
+
* cursor. 可选参数,用于分页请求,请求第1页cursor传-1,在返回的结果中会得到next_cursor字段,表示下一页的cursor。next_cursor为0表示已经到记录末尾。
+
# o 示例: http://api.t.sina.com.cn/statuses/friends/timyang.xml?cursor=-1
+
# o 示例: http://api.t.sina.com.cn/statuses/friends/timyang.xml?cursor=1300794057949944903
+
* count.  可选参数,每页返回的最大记录数,最大不能超过200,默认为20。
+
# o 示例: http://api.t.sina.com.cn/statuses/friends/bob.xml?count=200
+
 
+
=== 使用说明===
+
* id, user_id, screen_name 可以任选一个参数,在3个都不提供的情况下,系统返回当前用户的关注列表。
+
* 如果没有提供cursor参数,将只返回最前面的20个关注用户。
+
* 当以JSON方式返回时,返回结构会稍有不同。
+
 
+
=== 返回结果 ===
+
====XML====
+
 
<pre>
 
<pre>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
 
<users>
 
<users>
 
   <user>
 
   <user>
     <id>1644072040</id>
+
     <id>1473612611</id>
     <screen_name>董玉庆</screen_name>
+
     <screen_name>周立清</screen_name>
     <name>董玉庆</name>
+
     <name>周立清</name>
     <province>11</province>
+
     <province>14</province>
     <city>8</city>
+
     <city>1</city>
     <location>北京 海淀区</location>
+
     <location>山西 太原</location>
     <description>汝之素年,谁予锦时 Sina 微博开放平台对外合作,010-82626545,13911461126,yuqing1@staff.sina.com.cn</description>
+
     <description>新浪微博开放平台(open.t.sina.com.cn),欢迎广大站长朋友前来聊聊:13718188488 、 010-62676120 、QQ:3653550、liqing3@staff.sina.com.cn</description>
     <url>http://1</url>
+
     <url>http://www.linger.cn</url>
    <profile_image_url>http://tp1.sinaimg.cn/1644072040/50/1283421854</profile_image_url>
+
     <profile_image_url>http://tp4.sinaimg.cn/1473612611/50/1284048157/1</profile_image_url>
    <domain>janedyq</domain>
+
     <domain>xyzlinger</domain>
    <gender>f</gender>
+
    <followers_count>358</followers_count>
+
    <friends_count>303</friends_count>
+
    <statuses_count>1179</statuses_count>
+
    <favourites_count>1</favourites_count>
+
    <created_at>Mon Aug 31 00:00:00 +0800 2009</created_at>
+
    <following>false</following>
+
    <verified>false</verified>
+
    <allow_all_act_msg>false</allow_all_act_msg>
+
    <geo_enabled>false</geo_enabled>
+
    <status>
+
      <created_at>Mon Sep 13 17:24:29 +0800 2010</created_at>
+
      <id>2590421720</id>
+
      <text>猫咪睡姿 超级萌的猫猫睡姿 http://sinaurl.cn/h4Zxto</text>
+
      <source>
+
        <a href="http://www.xtalk.cn/">xweibo1</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://ss13.sinaimg.cn/thumbnail/61fe8c6849020a9c494bc&amp;690</thumbnail_pic>
+
      <bmiddle_pic>http://ss13.sinaimg.cn/bmiddle/61fe8c6849020a9c494bc&amp;690</bmiddle_pic>
+
      <original_pic>http://ss13.sinaimg.cn/orignal/61fe8c6849020a9c494bc&amp;690</original_pic>
+
    </status>
+
  </user>
+
  <user>
+
    <id>1197161814</id>
+
    <screen_name>李开复</screen_name>
+
    <name>李开复</name>
+
    <province>11</province>
+
    <city>1000</city>
+
    <location>北京</location>
+
    <description>创新工场CEO</description>
+
    <url>http://blog.sina.com.cn/kaifulee</url>
+
     <profile_image_url>http://tp3.sinaimg.cn/1197161814/50/1283203482</profile_image_url>
+
     <domain>kaifulee</domain>
+
 
     <gender>m</gender>
 
     <gender>m</gender>
     <followers_count>1748040</followers_count>
+
     <followers_count>4652</followers_count>
     <friends_count>120</friends_count>
+
     <friends_count>1060</friends_count>
     <statuses_count>725</statuses_count>
+
     <statuses_count>3897</statuses_count>
     <favourites_count>1</favourites_count>
+
     <favourites_count>5</favourites_count>
 
     <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
 
     <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
 
     <following>false</following>
 
     <following>false</following>
 
     <verified>true</verified>
 
     <verified>true</verified>
     <allow_all_act_msg>false</allow_all_act_msg>
+
     <allow_all_act_msg>true</allow_all_act_msg>
     <geo_enabled>false</geo_enabled>
+
     <geo_enabled>true</geo_enabled>
 +
    <remark/>
 
     <status>
 
     <status>
       <created_at>Mon Sep 13 09:41:41 +0800 2010</created_at>
+
       <created_at>Fri Dec 03 13:49:07 +0800 2010</created_at>
       <id>2578485930</id>
+
       <id>4051881415</id>
       <text>移动开发者大会 -- 10月21-22日 CSDN和创新工场将举办2010中国移动开发者大会,除了中国的移动互联网专家,特别请到第一次来华的Disney/Tapulous创始人、Twitter联合创始人、Google/Admob产品负责人等。http://sinaurl.cn/h9Mw0X</text>
+
       <text>哈哈,看到新浪@微博大屏幕 了[哈哈],第一条是@飞象网项立刚 的微博,给力![good]</text>
 
       <source>
 
       <source>
 
         <a href="http://t.sina.com.cn">新浪微博</a>
 
         <a href="http://t.sina.com.cn">新浪微博</a>
第114行: 第54行:
 
       <in_reply_to_user_id/>
 
       <in_reply_to_user_id/>
 
       <in_reply_to_screen_name/>
 
       <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>
 
     </status>
 
   </user>
 
   </user>
   <next_cursor>2</next_cursor>   //仅带cursor参数的时候有此字段
+
  ...
   <previous_cursor>0</previous_cursor> //仅带cursor参数的时候有此字段
+
   <next_cursor>1</next_cursor>
 +
   <previous_cursor>0</previous_cursor>
 
</users>
 
</users>
 
</pre>
 
</pre>
====JSON====
+
===JSON示例===
 
<pre>
 
<pre>
 
{
 
{
  "users":[
+
    "users" :  
      {
+
    [
        "id":1644072040,
+
        {
        "screen_name":"董玉庆",
+
            "name" : "周立清",
        "name":"董玉庆",
+
            "domain" : "xyzlinger",
        "province":"11",
+
            "geo_enabled" : true,
        "city":"8",
+
            "followers_count" : 4652,
        "location":"北京 海淀区",
+
            "statuses_count" : 3897,
        "description":"汝之素年,谁予锦时 Sina 微博开放平台对外合作,010-82626545,13911461126,yuqing1@staff.sina.com.cn",
+
            "favourites_count" : 5,
        "url":"http://1",
+
            "city" : "1",
        "profile_image_url":"http://tp1.sinaimg.cn/1644072040/50/1283421854",
+
            "description" : "新浪微博开放平台(open.t.sina.com.cn),欢迎广大站长朋友前来聊聊:13718188488 、 010-62676120 、QQ:3653550、liqing3@staff.sina.com.cn",
        "domain":"janedyq",
+
            "verified" : true,
        "gender":"f",
+
            "remark" : "",
        "followers_count":358,
+
            "status" :  
        "friends_count":303,
+
            {
        "statuses_count":1179,
+
                "created_at" : "Fri Dec 03 13:49:07 +0800 2010",
        "favourites_count":1,
+
                "text" : "哈哈,看到新浪@微博大屏幕 了[哈哈],第一条是@飞象网项立刚 的微博,给力![good]",
        "created_at":"Mon Aug 31 00:00:00 +0800 2009",
+
                "truncated" : false,
        "following":false,
+
                "retweeted_status" :  
        "allow_all_act_msg":false,
+
                {
        "geo_enabled":false,
+
                    "created_at" : "Fri Dec 03 13:45:02 +0800 2010",
        "verified":false,
+
                    "text" : "#3G创新应用#工信部电信研究院通信信息所所长徐玉正在演讲,数据很详实,人也很漂亮。",
        "status":{
+
                    "bmiddle_pic" : "http://ww3.sinaimg.cn/bmiddle/4c1526eajw6dbzdl54fmoj.jpg",
            "created_at":"Mon Sep 13 17:24:29 +0800 2010",
+
                    "original_pic" : "http://ww3.sinaimg.cn/large/4c1526eajw6dbzdl54fmoj.jpg",
            "id":2590421720,
+
                    "truncated" : false,
            "text":"猫咪睡姿 超级萌的猫猫睡姿 http://sinaurl.cn/h4Zxto",
+
                    "in_reply_to_status_id" : "",
            "source":"<a href=\"http://www.xtalk.cn/\" rel=\"nofollow\">xweibo1</a>",
+
                    "annotations" :  
            "favorited":false,
+
                    [
            "truncated":false,
+
 
            "in_reply_to_status_id":"",
+
                    ],
            "in_reply_to_user_id":"",
+
                    "in_reply_to_screen_name" : "",
            "in_reply_to_screen_name":"",
+
                    "geo" : null,
            "thumbnail_pic":"http://ss13.sinaimg.cn/thumbnail/61fe8c6849020a9c494bc&690",
+
                    "user" :  
            "bmiddle_pic":"http://ss13.sinaimg.cn/bmiddle/61fe8c6849020a9c494bc&690",
+
                    {
            "original_pic":"http://ss13.sinaimg.cn/orignal/61fe8c6849020a9c494bc&690",
+
                        "name" : "孙慧飞象",
            "geo":null
+
                        "domain" : "sunhui123",
        }
+
                        "geo_enabled" : true,
      },
+
                        "followers_count" : 871,
      {
+
                        "statuses_count" : 552,
        "id":1197161814,
+
                        "favourites_count" : 4,
        "screen_name":"李开复",
+
                        "city" : "5",
        "name":"李开复",
+
                        "description" : "远树两行山倒影,轻舟一叶水平流",
        "province":"11",
+
                        "verified" : true,
        "city":"1000",
+
                        "id" : 1276454634,
        "location":"北京",
+
                        "gender" : "f",
        "description":"创新工场CEO",
+
                        "friends_count" : 314,
        "url":"http://blog.sina.com.cn/kaifulee",
+
                        "screen_name" : "孙慧飞象",
        "profile_image_url":"http://tp3.sinaimg.cn/1197161814/50/1283203482",
+
                        "allow_all_act_msg" : true,
        "domain":"kaifulee",
+
                        "following" : false,
        "gender":"m",
+
                        "url" : "http://blog.sina.com.cn/sunhuiblog",
        "followers_count":1748040,
+
                        "profile_image_url" : "http://tp3.sinaimg.cn/1276454634/50/1283155247/0",
        "friends_count":120,
+
                        "created_at" : "Fri Oct 16 00:00:00 +0800 2009",
        "statuses_count":725,
+
                        "province" : "11",
        "favourites_count":1,
+
                        "location" : "北京 朝阳区"
        "created_at":"Fri Aug 28 00:00:00 +0800 2009",
+
                    },
        "following":false,
+
                    "favorited" : false,
        "allow_all_act_msg":false,
+
                    "thumbnail_pic" : "http://ww3.sinaimg.cn/thumbnail/4c1526eajw6dbzdl54fmoj.jpg",
        "geo_enabled":false,
+
                    "in_reply_to_user_id" : "",
        "verified":true,
+
                    "id" : 4051797049,
        "status":{
+
                    "source" : "<a href=\"http://t.sina.com.cn/mobile/msg.php\" rel=\"nofollow\">彩信</a>"
            "created_at":"Mon Sep 13 09:41:41 +0800 2010",
+
                },
            "id":2578485930,
+
                "in_reply_to_status_id" : "",
            "text":"移动开发者大会 -- 10月21-22日 CSDN和创新工场将举办2010中国移动开发者大会,除了中国的移动互联网专家,特别请到第一次来华的Disney/Tapulous创始人、Twitter联合创始人、Google/Admob产品负责人等。http://sinaurl.cn/h9Mw0X",
+
                "annotations" :  
            "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>",
+
                [
             "favorited":false,
+
 
             "truncated":false,
+
                ],
             "in_reply_to_status_id":"",
+
                "in_reply_to_screen_name" : "",
             "in_reply_to_user_id":"",
+
                "geo" : null,
             "in_reply_to_screen_name":"",
+
                "favorited" : false,
             "geo":null
+
                "in_reply_to_user_id" : "",
        }
+
                "id" : 4051881415,
      }
+
                "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
  ],
+
            },
  "next_cursor":2, //仅带cursor参数的时候有此字段
+
             "id" : 1473612611,
  "previous_cursor":0 //仅带cursor参数的时候有此字段
+
             "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>
 
</pre>
 
{{param_user}}
 
{{param_user}}
{{param_status}}
+
{{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个关注用户。|
* xml:
+
otherInfo=
# curl -u uid:password http://api.t.sina.com.cn/statuses/friends.xml?source=appkey
+
# curl -u uid:password http://api.t.sina.com.cn/statuses/friends/timyang.xml?source=appkey
+
# curl -u uid:password http://api.t.sina.com.cn/statuses/friends/timyang.xml?cursor=-1&source=appkey
+
 
+
* json:
+
# curl -u uid:password http://api.t.sina.com.cn/statuses/friends.json?source=appkey
+
# curl -u uid:password http://api.t.sina.com.cn/statuses/friends/timyang.json?source=appkey
+
# curl -u uid:password http://api.t.sina.com.cn/statuses/friends/timyang.json?cursor=-1&source=appkey
+
  
====Java示例====
+
===Java示例===
 
请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br>
 
请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br>
 
代码示例如下:
 
代码示例如下:
第255行: 第243行:
 
      }
 
      }
 
  }
 
  }
====PHP示例====
+
===PHP示例===
 
请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br>  
 
请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br>  
 
代码示例如下:
 
代码示例如下:
第279行: 第267行:
 
}
 
}
 
</pre>
 
</pre>
 +
}}

2012年9月24日 (一) 11:38的最后版本

目录

statuses/friends

获取用户关注列表及每个关注用户的最新一条微博,返回结果按关注时间倒序排列,最新关注的用户排在最前面。

URL

http://api.t.sina.com.cn/statuses/friends.(json%7Cxml)

支持格式

XML/JSON

HTTP请求方式

GET

是否需要登录

true
关于授权机制,参见授权机制声明

请求数限制

true
关于请求数限制,参见接口访问权限说明

请求参数

  必选 类型及范围 说明
source true string 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数)
:id false int64/string 用户ID(int64)或者昵称(string)。该参数为一个REST风格参数。调用示例见注意事项
user_id false int64 用户ID,主要是用来区分用户ID跟微博昵称。当微博昵称为数字导致和用户ID产生歧义,特别是当微博昵称和用户ID一样的时候,建议使用该参数
screen_name false string 微博昵称,主要是用来区分用户UID跟微博昵称,当二者一样而产生歧义的时候,建议使用该参数
cursor false int 用于分页请求,请求第1页cursor传-1,在返回的结果中会得到next_cursor字段,表示下一页的cursor。next_cursor为0表示已经到记录末尾。
count false int,默认20,最大200 每页返回的最大记录数,最大不能超过200,默认为20。
:id, user_id, screen_name 可以任选一个参数,在3个都不提供的情况下,系统返回当前登录用户的关注列表

注意事项

返回结果

XML示例

<?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>

JSON示例

{
    "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
}

字段说明 - user

  • id: 用户UID
  • screen_name: 微博昵称
  • name: 友好显示名称,同微博昵称
  • province: 省份编码(参考省份编码表)
  • city: 城市编码(参考城市编码表)
  • location:地址
  • description: 个人描述
  • url: 用户博客地址
  • profile_image_url: 自定义图像
  • domain: 用户个性化URL
  • gender: 性别,m--男,f--女,n--未知
  • followers_count: 粉丝数
  • friends_count: 关注数
  • statuses_count: 微博数
  • favourites_count: 收藏数
  • created_at: 创建时间
  • following: 是否已关注(此特性暂不支持)
  • verified: 加V标示,是否微博认证用户

字段说明 - status

  • created_at: 创建时间
  • id: 微博ID
  • text: 微博信息内容
  • source: 微博来源
  • favorited: 是否已收藏
  • truncated: 是否被截断
  • in_reply_to_status_id: 回复ID
  • in_reply_to_user_id: 回复人UID
  • in_reply_to_screen_name: 回复人昵称
  • thumbnail_pic: 缩略图
  • bmiddle_pic: 中型图片
  • original_pic:原始图片
  • user: 作者信息
  • retweeted_status: 转发的博文,内容为status,如果不是转发,则没有此字段

其他

Java示例

请从 微博SDK开发包下载 下载Java SDK
代码示例如下:

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开发包下载 处下载PHP SDK(支持OAuth验证之版本)
代码示例如下:

//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'].' ;');
}
文档更新时间: 2012-09-24