Skip to content

search.users

lisztli edited this page Feb 7, 2012 · 6 revisions

#GET /search/users

搜索全站用户(只返回其中未被ban掉的用户)

##路径

http://api.fanfou.com/search/users.[json|xml]

##调用方法

GET 

##参数:

###q

  • 作用: 搜索关键词

  • 格式: q=query_word

  • 字段说明: 必选

###count

  • 作用: 指定返回用户的数量, 默认为20

  • 格式: count=user_count

  • 字段说明: 可选, count 取值范围1至60

###page

  • 作用: page用于指定返回结果的页码

  • 格式: page=page_id

  • 字段说明: 可选

###mode

  • 作用: 当mode=default(默认)时,返回消息中用户信息包含用户自定义profile.mode=lite, profile不会包含在返回信息中

  • 格式: mode=[default|lite]

  • 字段说明: 可选

###format

  • 作用: 当format=html时,返回消息中@提到的用户,网址等输出html链接

  • 格式: format=html

  • 字段说明: 可选

###callback

  • 格式: callback=javascript函数名

  • 作用: 当使用json格式时,生成的json对象将作为参数传给指定的javascript函数

  • 字段说明: 可选

##返回结果

###成功

  • HTTP Status Code

    200 OK HTTP/1.1

  • 返回值

    • json格式

      json格式解释请见下方示例 返回一个由user object组成的数组,user object的格式参见users.show

        {
            'total_number': total_number,
            'users': {
                user_0,
                user_1,
                user_2,
                user_3,
                user_4,
                ...
            }
        }
      
    • xml格式

      xml格式解释请见下方示例

##示例

###请求URL

GET http://api.fanfou.com/search/users.xml?q=fanfou&count=1

###返回结果

<?xml version="1.0" encoding="UTF-8"?>
<users total-number="26">
	<user>
		<id>fanfou0</id>
		<name>fanfou</name>
		<screen_name>fanfou</screen_name>
		<location></location>
		<gender></gender>
		<birthday></birthday>
		<description><![CDATA[]]></description>
		<profile_image_url>http://avatar.fanfou.com/s0/00/00/00.jpg</profile_image_url>
		<url><![CDATA[]]></url>
		<protected>false</protected>
		<friends_count>0</friends_count>
		<followers_count>0</followers_count>
		<favourites_count>0</favourites_count>
		<statuses_count>0</statuses_count>
		<created_at>Thu May 17 05:20:23 +0000 2007</created_at>
		<utc_offset>28800</utc_offset>
		<notifications>false</notifications>
		<following>false</following>
        <profile_background_color>#acdae5</profile_background_color>
		<profile_text_color>#222222</profile_text_color>
		<profile_link_color>#0066cc</profile_link_color>
		<profile_sidebar_fill_color>#e2f2da</profile_sidebar_fill_color>
		<profile_sidebar_border_color>#b2d1a3</profile_sidebar_border_color>
		<profile_background_image_url>/static/img/bg/0.png</profile_background_image_url>
		<profile_background_tile>true</profile_background_tile>
	</user>
</users>

###请求URL

GET http://api.fanfou.com/search/users.json?q=fanfou

###返回结果 { users: [{"id": "test", "name": "测试昵称", "screen_name": "测试昵称", "location": "北京 海淀区", "gender": "男", "birthday": "2105-03-11", "description": "测试帐号", "profile_image_url": "http://avatar3.fanfou.com/s0/00/5n/sk.jpg?1320913295", "profile_image_url_large": "http://avatar3.fanfou.com/l0/00/5n/sk.jpg?1320913295", "url": "http://fanfou.com/test", "protected": true, "followers_count": 9, "friends_count": 16, "favourites_count": 23, "statuses_count": 124, "following": false, "notifications": false, "created_at": "Sat Jun 09 23:56:33 +0000 2007", "utc_offset": 28800, "profile_background_color": "#ffffe5", "profile_text_color": "#004040", "profile_link_color": "#ff0000", "profile_sidebar_fill_color": "#ffefbf", "profile_sidebar_border_color": "#ffac80", "profile_background_image_url": "http://avatar.fanfou.com/b0/00/5n/sk_1320749993.jpg", "profile_background_tile": true, "status": { "created_at": "Thu Nov 10 09:37:34 +0000 2011", "id": "XRFWGErKgGI", "text": "这是神马?", "source": "<a href="http://abc.fanfouapps.com" target="_blank">ABC", "truncated": false, "in_reply_to_lastmsg_id": "", "in_reply_to_user_id": "", "favorited": false, "in_reply_to_screen_name": "" } } ], total_number: 86 }

###字段说明

字段返回值 字段类型 字段说明
users object array 用户信息,格式参见users.show
total_number int 搜索结果的个数
Clone this wiki locally