Users/search

跳转到: 导航, 搜索
第1行: 第1行:
 
{{api_desc2|
 
{{api_desc2|
 
uri=users/search|
 
uri=users/search|
desc=返回关键字匹配的微博用户。|
+
desc=返回与关键字相匹配的微博用户。|
 
format=XML/JSON|
 
format=XML/JSON|
 
httpMethod=GET|
 
httpMethod=GET|

2010年12月9日 (四) 10:37的版本

目录

users/search

返回与关键字相匹配的微博用户。

URL

http://api.t.sina.com.cn/users/search.(json%7Cxml)

支持格式

XML/JSON

HTTP请求方式

GET

是否需要登录

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

请求数限制

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

请求参数

  必选 类型及范围 说明
source true string 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数)
q true string 搜索的关键字。必须进行URL Encode
snick false int 搜索范围是否包含昵称。0为不包含,1为包含。
sdomain false int 搜索范围包含个性域名。0为不包含,1为包含。
sintro false int 搜索范围包含简介。0为不包含,1为包含。
province false int 省份ID,参考省份城市编码表
city false int 城市ID,参考省份城市编码表
gender false string 性别 (m 为男,f 为女)
comorsch false string 公司学校名称。
sort false int 排序方式,1为按更新时间,2为按粉丝数。
page false int 页码
count false int 分页大小(默认返回10条)
callback false string 仅json方式支持,用于JSONP跨域数据访问。可以传入JavaScript函数名。

注意事项

  • 搜索关键词如果为空,则返回400错误。

返回结果

XML示例

<?xml version="1.0" encoding="UTF-8"?>
<searchResult>
  <users>
    <user>
      <id>1795666007</id>
      <screen_name>王若琳星闻</screen_name>
      <name>王若琳星闻</name>
      <province>11</province>
      <city>1000</city>
      <location>北京</location>
      <description/>
      <url/>
      <profile_image_url>http://tp4.sinaimg.cn/1795666007/50/1282886247/0</profile_image_url>
      <domain/>
      <gender>f</gender>
      <followers_count>286</followers_count>
      <friends_count>213</friends_count>
      <statuses_count>9</statuses_count>
      <favourites_count>0</favourites_count>
      <created_at>Sun Aug 15 00:00:00 +0800 2010</created_at>
      <following>false</following>
      <verified>false</verified>
      <allow_all_act_msg>true</allow_all_act_msg>
      <geo_enabled>true</geo_enabled>
      <status>
        <created_at>Tue Oct 26 13:24:19 +0800 2010</created_at>
        <id>3277931869</id>
        <text>【环保音乐会世博奏响 王若琳自曝宅女环保生活】 当晚,整个舞台群星璀璨,王若琳倾情演绎《Adult crap》《玫瑰玫瑰我爱你》一举征服了观众的心,著名环保歌手朱哲琴则用她空灵的歌声一曲《阿姐鼓》震撼全场,仿佛将观众...http://sinaurl.cn/h4WVid</text>
        <source>
          <a href="">微博开放平台接口</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://ss7.sinaimg.cn/thumbnail/6b07b0574937e5218ba66&690</thumbnail_pic>
        <bmiddle_pic>http://ss7.sinaimg.cn/bmiddle/6b07b0574937e5218ba66&690</bmiddle_pic>
        <original_pic>http://ss7.sinaimg.cn/orignal/6b07b0574937e5218ba66&690</original_pic>
      </status>
    </user>
    ...
  </users>
</searchResult>

JSON示例

foo(
	[
	    {
		"name" : "王若琳",
		"domain" : "",
		"geo_enabled" : true,
		"followers_count" : 52,
		"statuses_count" : 6,
		"favourites_count" : 0,
		"city" : "5",
		"description" : "我啊!不说了!",
		"verified" : false,
		"id" : 1427803427,
		"gender" : "f",
		"friends_count" : 11,
		"screen_name" : "王若琳",
		"allow_all_act_msg" : false,
		"following" : false,
		"url" : "",
		"profile_image_url" : "http://tp4.sinaimg.cn/1427803427/50/1259749109/0",
		"created_at" : "Wed Dec 02 00:00:00 +0800 2009",
		"province" : "11",
		"location" : "北京 朝阳区"
	    },
	    ...
	]
)

注意: JSON示例展示的是callback参数传入foo以后的返回结果,可以看出,在JavaScript中,这是一个传入了JSON对象的函数调用。如果没有使用callback参数,则返回结果为一个JSON对象。

其他