Users/search
(→请求参数) |
|||
(未显示2个用户的7个中间版本) | |||
第1行: | 第1行: | ||
− | + | {{api_desc2| | |
− | + | uri=users/search| | |
− | + | desc=返回与关键字相匹配的微博用户。| | |
− | = | + | format=XML/JSON| |
− | + | httpMethod=GET| | |
− | + | needAuth=false| | |
− | + | rateLimit=true| | |
− | + | params={{api_args|q|true|string|搜索的关键字。必须进行URL Encode}} | |
− | + | {{api_args|snick|false|int|搜索范围是否包含昵称。0为不包含,1为包含。}} | |
− | = | + | {{api_args|sdomain|false|int|搜索范围包含个性域名。0为不包含,1为包含。}} |
− | GET | + | {{api_args|sintro|false|int|搜索范围包含简介。0为不包含,1为包含。}} |
− | + | {{api_args|province|false|int|省份ID,参考[[省份城市编码表]]}} | |
− | + | {{api_args|city|false|int|城市ID,参考[[省份城市编码表]]}} | |
− | + | {{api_args|gender|false|string|性别 (m 为男,f 为女)}} | |
− | + | {{api_args|comorsch|false|string|公司学校名称。}} | |
− | = | + | {{api_args|sort|false|int|排序方式,1为按更新时间,2为按粉丝数。}} |
− | true | + | {{api_args|page|false|int|页码}} |
− | + | {{api_args|count|false|int|每页返回的微博数。(默认返回10条)}} | |
− | = | + | {{api_args|callback|false|string|仅JSON方式支持,用于JSONP跨域数据访问。}} |
− | + | {{api_args|base_app|false|int|是否基于当前应用来获取数据。1表示基于当前应用来获取数据。}}| | |
− | + | getParam=&q=王若琳&callback=foo| | |
− | + | postParam=| | |
− | + | result= | |
− | + | ===XML示例=== | |
− | + | <pre> | |
− | + | <?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> | |
− | + | </pre> | |
− | + | ===JSON示例(无callback参数)=== | |
− | + | <pre> | |
− | + | [ | |
− | + | { | |
− | + | "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" : "北京 朝阳区" | |
− | + | }, | |
− | + | .... | |
+ | ] | ||
+ | </pre> | ||
+ | ===JSON示例(callback=foo)=== | ||
+ | <pre> | ||
+ | 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" : "北京 朝阳区" | ||
+ | }, | ||
+ | ... | ||
+ | ] | ||
+ | ) | ||
+ | </pre>| | ||
+ | useAge= | ||
+ | * 搜索关键词如果为空,则返回400错误。| | ||
+ | otherInfo=无 | ||
+ | }}{{#a:showgrade}} |
2011年1月5日 (三) 11:13的最后版本
目录 |
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跨域数据访问。 |
base_app | false | int | 是否基于当前应用来获取数据。1表示基于当前应用来获取数据。 |
注意事项
- 搜索关键词如果为空,则返回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示例(无callback参数)
[ { "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)
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" : "北京 朝阳区" }, ... ] )
其他
无
文档更新时间: 2011-01-05