跳转到: 导航, 搜索
第1行: 第1行:
 
{{api_desc_v2|
 
{{api_desc_v2|
 
uri=friendships/groups|
 
uri=friendships/groups|
desc=获取当前登录用户的好友分组列表|
+
desc=获取指定用户的好友分组列表|
 
httpMethod=GET|
 
httpMethod=GET|
 
needAuth=是|
 
needAuth=是|
 
level={{Api_L2}}|
 
level={{Api_L2}}|
 
rateLimit=是|
 
rateLimit=是|
params=|
+
params=
 +
{{api_args|uid|false|int64|需要查询的指定用户UID,如果指定的UID不是当前登录用户,则只能获取到对方设置为可见的公开分组,默认不填为当前登录用户。}}
 +
{{api_args|mode|false|string|返回的好友分组类型,all:当前登录用户可见的分组、public:公开分组、private:私有分组,默认为all。}}|
 
result=
 
result=
 
<pre>
 
<pre>
第12行: 第14行:
 
     "lists": [
 
     "lists": [
 
         {
 
         {
             "id": 201101270045006180,
+
             "id": 3404979794629010,
             "idstr": "201101270045006191",
+
             "idstr": "3404979794629010",
             "name": "同学"
+
             "name": "同事",
        },
+
            "mode": "private",
        {
+
            "visible": 0,
             "id": 201110270443452670,
+
             "like_count": 0,
             "idstr": "201110270443452677",
+
             "member_count": 0,
             "name": "同事"
+
            "description": "",
 +
             "tags": [],
 +
            "profile_image_url": "http://tp1.sinaimg.cn/1404376560/50/5629870687/1",
 +
            "user": {
 +
                "id": 1404376560,
 +
                "idstr": "1404376560",
 +
                "screen_name": "zaku",
 +
                "name": "zaku",
 +
                "province": "11",
 +
                "city": "5",
 +
                "location": "北京 朝阳区",
 +
                "description": "微博开放平台产品。人生五十年,乃如梦如幻;有生斯有死,壮士复何憾。",
 +
                "url": "http://blog.sina.com.cn/zaku",
 +
                "profile_image_url": "http://tp1.sinaimg.cn/1404376560/50/5629870687/1",
 +
                "profile_url": "zaku",
 +
                "domain": "zaku",
 +
                "weihao": "",
 +
                "gender": "m",
 +
                "followers_count": 1441,
 +
                "friends_count": 601,
 +
                "statuses_count": 3534,
 +
                "favourites_count": 13,
 +
                "created_at": "Fri Aug 28 00:00:00 +0800 2009",
 +
                "following": false,
 +
                "allow_all_act_msg": false,
 +
                "geo_enabled": true,
 +
                "verified": false,
 +
                "verified_type": -1,
 +
                "status_id": 3451328979913246,
 +
                "allow_all_comment": true,
 +
                "avatar_large": "http://tp1.sinaimg.cn/1404376560/180/5629870687/1",
 +
                "verified_reason": "",
 +
                "follow_me": false,
 +
                "online_status": 0,
 +
                "bi_followers_count": 286,
 +
                "lang": "zh-cn"
 +
            },
 +
            "created_at": "Mon Jan 23 12:45:05 +0800 2012"
 
         },
 
         },
 
         ...
 
         ...
 
     ],
 
     ],
     "next_cursor": 0,
+
     "total_number": 6
    "previous_cursor": 0
+
 
}
 
}
 
</pre>|
 
</pre>|
 
resultDes=无|
 
resultDes=无|
 
useAge=
 
useAge=
 +
*只有查询的指定用户是当前登录用户时,才能获取到私有分组(private)的数据;
 
*返回的数据按设置的分组顺序排序;
 
*返回的数据按设置的分组顺序排序;
 
*好友分组上限为20,“未分组”不计入上限;
 
*好友分组上限为20,“未分组”不计入上限;

2012年5月30日 (三) 17:38的版本

friendships/groups

获取指定用户的好友分组列表

URL

https://api.weibo.com/2/friendships/groups.json

支持格式

JSON

HTTP请求方式

GET

是否需要登录


关于登录授权,参见 如何登录授权

访问授权限制

访问级别:高级接口(需要授权)
频次限制:
关于频次限制,参见 接口访问权限说明

请求参数

  必选 类型及范围 说明
access_token true string 采用OAuth授权方式为必填参数,OAuth授权后获得。
uid false int64 需要查询的指定用户UID,如果指定的UID不是当前登录用户,则只能获取到对方设置为可见的公开分组,默认不填为当前登录用户。
mode false string 返回的好友分组类型,all:当前登录用户可见的分组、public:公开分组、private:私有分组,默认为all。

注意事项

  • 只有查询的指定用户是当前登录用户时,才能获取到私有分组(private)的数据;
  • 返回的数据按设置的分组顺序排序;
  • 好友分组上限为20,“未分组”不计入上限;
  • "未分组"的分组ID为0;

调用样例及调试工具

API测试工具

返回结果

JSON示例

{
    "lists": [
        {
            "id": 3404979794629010,
            "idstr": "3404979794629010",
            "name": "同事",
            "mode": "private",
            "visible": 0,
            "like_count": 0,
            "member_count": 0,
            "description": "",
            "tags": [],
            "profile_image_url": "http://tp1.sinaimg.cn/1404376560/50/5629870687/1",
            "user": {
                "id": 1404376560,
                "idstr": "1404376560",
                "screen_name": "zaku",
                "name": "zaku",
                "province": "11",
                "city": "5",
                "location": "北京 朝阳区",
                "description": "微博开放平台产品。人生五十年,乃如梦如幻;有生斯有死,壮士复何憾。",
                "url": "http://blog.sina.com.cn/zaku",
                "profile_image_url": "http://tp1.sinaimg.cn/1404376560/50/5629870687/1",
                "profile_url": "zaku",
                "domain": "zaku",
                "weihao": "",
                "gender": "m",
                "followers_count": 1441,
                "friends_count": 601,
                "statuses_count": 3534,
                "favourites_count": 13,
                "created_at": "Fri Aug 28 00:00:00 +0800 2009",
                "following": false,
                "allow_all_act_msg": false,
                "geo_enabled": true,
                "verified": false,
                "verified_type": -1,
                "status_id": 3451328979913246,
                "allow_all_comment": true,
                "avatar_large": "http://tp1.sinaimg.cn/1404376560/180/5629870687/1",
                "verified_reason": "",
                "follow_me": false,
                "online_status": 0,
                "bi_followers_count": 286,
                "lang": "zh-cn"
            },
            "created_at": "Mon Jan 23 12:45:05 +0800 2012"
        },
        ...
    ],
    "total_number": 6
}

关于错误返回值与错误代码,参见 错误代码说明

返回字段说明

其他

相关问题

{{{relat_qa}}}


帮助中心 查看更多问题或提问


Language: [[{{{2/uri}}}|中文]]




api评价