Search
(创建新页面为 '== statuses/search == 返回关键字匹配的微博。 === URL=== http://api.t.sina.com.cn/statuses/search.json === 格式=== 仅支持json GET === 是否需要登录==…') |
|||
(未显示4个用户的14个中间版本) | |||
第1行: | 第1行: | ||
− | = | + | {{api_desc| |
− | + | uri=search| | |
− | + | desc=返回与关键字相匹配的微博。| | |
− | + | format=json| | |
− | + | httpMethod=GET| | |
− | + | needAuth=false| | |
− | === | + | rateLimit=true| |
− | + | params={{api_args|q|true|string|搜索的关键字。必须进行URL Encode}} | |
− | + | {{api_args|page|false|int|页码,从1开始,默认为1。}} | |
− | + | {{api_args|rpp|false|int|每页返回的微博数。(默认返回10条,最大200条)}} | |
− | + | {{api_args|callback|false|string|仅JSON方式支持,用于JSONP跨域数据访问。}} | |
− | + | {{api_args|geocode|false|string|返回指定经纬度附近的信息。经纬度参数格式是“纬度,经度,半径”,半径支持km(公里),m(米),mi(英里)。格式需要URL Encode编码}}| | |
− | === | + | getParam=&q=王若琳&callback=foo| |
− | + | postParam=| | |
− | + | result= | |
− | === | + | ===JSON示例(无callback参数)=== |
− | + | <pre> | |
− | + | { | |
− | + | "results":[ | |
− | + | { | |
− | : | + | "to_user_id":1728647563, |
− | : | + | "to_user":"kiroro恋", |
− | + | "text":"喜欢坐在你的车里听王若琳的歌", | |
− | : | + | "id":4192745203, |
− | + | "from_user_id":1728647563, | |
− | : | + | "from_user":"kiroro恋", |
− | + | "iso_language_code":"nl", | |
− | : | + | "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>", |
− | + | "profile_image_url":"http://tp4.sinaimg.cn/1728647563/50/1289280876/0", | |
− | === | + | "created_at":"Thu Dec 09 13:57:20 +0800 2010" |
− | + | }, | |
− | + | ... | |
− | + | ], | |
− | + | "since_id":0, | |
− | + | "max_id":4192745203, | |
− | + | "results_per_page":0, | |
− | + | "next_page":"?page=2&max_id=1291869235&q=王若琳", | |
− | + | "refresh_url":"?since_id=1291874240&q=王若琳", | |
− | + | "completed_in":0.24699999392032623, | |
− | + | "page":1,"query":"王若琳" | |
− | + | } | |
− | + | </pre> | |
− | + | ===JSON示例(callback=foo)=== | |
− | + | <pre> | |
− | + | foo( | |
− | + | { | |
− | + | "results":[ | |
− | + | { | |
− | + | "to_user_id":1728647563, | |
− | + | "to_user":"kiroro恋", | |
− | + | "text":"喜欢坐在你的车里听王若琳的歌", | |
− | + | "id":4192745203, | |
− | * | + | "from_user_id":1728647563, |
− | + | "from_user":"kiroro恋", | |
+ | "iso_language_code":"nl", | ||
+ | "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>", | ||
+ | "profile_image_url":"http://tp4.sinaimg.cn/1728647563/50/1289280876/0", | ||
+ | "created_at":"Thu Dec 09 13:57:20 +0800 2010" | ||
+ | }, | ||
+ | ], | ||
+ | "since_id":0, | ||
+ | "max_id":4192745203, | ||
+ | "results_per_page":0, | ||
+ | "next_page":"?page=2&max_id=1291869235&q=王若琳", | ||
+ | "refresh_url":"?since_id=1291874240&q=王若琳", | ||
+ | "completed_in":0.24699999392032623, | ||
+ | "page":1,"query":"王若琳" | ||
+ | } | ||
+ | ) | ||
+ | </pre>| | ||
+ | useAge= | ||
+ | * 搜索关键词如果为空,返回结果为空。| | ||
+ | otherInfo=无 | ||
+ | }}{{#a:showgrade}} |
2011年1月24日 (一) 10:01的最后版本
目录 |
search
返回与关键字相匹配的微博。
URL
http://api.t.sina.com.cn/search.(json)
支持格式
json
HTTP请求方式
GET
是否需要登录
false
关于授权机制,参见授权机制声明
请求数限制
true
关于请求数限制,参见接口访问权限说明
请求参数
必选 | 类型及范围 | 说明 | |
---|---|---|---|
source | true | string | 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数) |
q | true | string | 搜索的关键字。必须进行URL Encode |
page | false | int | 页码,从1开始,默认为1。 |
rpp | false | int | 每页返回的微博数。(默认返回10条,最大200条) |
callback | false | string | 仅JSON方式支持,用于JSONP跨域数据访问。 |
geocode | false | string | 返回指定经纬度附近的信息。经纬度参数格式是“纬度,经度,半径”,半径支持km(公里),m(米),mi(英里)。格式需要URL Encode编码 |
调用示例
- json
- curl -u "username:password" "http://api.t.sina.com.cn/search.json?source=appkey&q=王若琳&callback=foo"
注意事项
- 搜索关键词如果为空,返回结果为空。
返回结果
JSON示例(无callback参数)
{ "results":[ { "to_user_id":1728647563, "to_user":"kiroro恋", "text":"喜欢坐在你的车里听王若琳的歌", "id":4192745203, "from_user_id":1728647563, "from_user":"kiroro恋", "iso_language_code":"nl", "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>", "profile_image_url":"http://tp4.sinaimg.cn/1728647563/50/1289280876/0", "created_at":"Thu Dec 09 13:57:20 +0800 2010" }, ... ], "since_id":0, "max_id":4192745203, "results_per_page":0, "next_page":"?page=2&max_id=1291869235&q=王若琳", "refresh_url":"?since_id=1291874240&q=王若琳", "completed_in":0.24699999392032623, "page":1,"query":"王若琳" }
JSON示例(callback=foo)
foo( { "results":[ { "to_user_id":1728647563, "to_user":"kiroro恋", "text":"喜欢坐在你的车里听王若琳的歌", "id":4192745203, "from_user_id":1728647563, "from_user":"kiroro恋", "iso_language_code":"nl", "source":"<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>", "profile_image_url":"http://tp4.sinaimg.cn/1728647563/50/1289280876/0", "created_at":"Thu Dec 09 13:57:20 +0800 2010" }, ], "since_id":0, "max_id":4192745203, "results_per_page":0, "next_page":"?page=2&max_id=1291869235&q=王若琳", "refresh_url":"?since_id=1291874240&q=王若琳", "completed_in":0.24699999392032623, "page":1,"query":"王若琳" } )
其他
无
文档更新时间: 2011-01-24