Search

跳转到: 导航, 搜索
(创建新页面为 '== statuses/search == 返回关键字匹配的微博。 === URL=== http://api.t.sina.com.cn/statuses/search.json === 格式=== 仅支持json GET === 是否需要登录==…')
 
 
(未显示4个用户的14个中间版本)
第1行: 第1行:
== statuses/search ==
+
{{api_desc|
返回关键字匹配的微博。
+
uri=search|
 
+
desc=返回与关键字相匹配的微博。|
=== URL===
+
format=json|
http://api.t.sina.com.cn/statuses/search.json
+
httpMethod=GET|
+
needAuth=false|
=== 格式===
+
rateLimit=true|
仅支持json
+
params={{api_args|q|true|string|搜索的关键字。必须进行URL Encode}}
+
{{api_args|page|false|int|页码,从1开始,默认为1。}}
 
+
{{api_args|rpp|false|int|每页返回的微博数。(默认返回10条,最大200条)}}
GET
+
{{api_args|callback|false|string|仅JSON方式支持,用于JSONP跨域数据访问。}}
+
{{api_args|geocode|false|string|返回指定经纬度附近的信息。经纬度参数格式是“纬度,经度,半径”,半径支持km(公里),m(米),mi(英里)。格式需要URL Encode编码}}|
=== 是否需要登录===
+
getParam=&q=王若琳&callback=foo|
true
+
postParam=|
+
result=
=== 请求数限制===
+
===JSON示例(无callback参数)===
true
+
<pre>
 
+
{
===请求参数===
+
"results":[
* q: 选填参数. 查询的关键字。必须进行[http://en.wikipedia.org/wiki/URL_encoding url encode]
+
{
:o 示例: http://api.t.sina.com.cn/statuses/search.json?q=api
+
"to_user_id":1728647563,
:o 示例: http://api.t.sina.com.cn/statuses/search.json?q=api&endtime=1256289598
+
"to_user":"kiroro恋",
* page: 选填参数,页码(从1开始, 默认1)
+
"text":"喜欢坐在你的车里听王若琳的歌",
:o 示例: http://api.t.sina.com.cn/statuses/search.json?q=api&sort=1&page=1
+
"id":4192745203,
* rpp(别名:rpp):选填参数,每页返回的微博数,默认返回10条,最大200
+
"from_user_id":1728647563,
:o 示例: http://api.t.sina.com.cn/statuses/search.json?q=api&rpp=10
+
"from_user":"kiroro恋",
* callback: 可选参数. 仅JSON方式支持,用于JSONP callback作用。
+
"iso_language_code":"nl",
:o 示例: http://api.t.sina.com.cn/statuses/search.json?q=api&callback=foo
+
"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"
XML示例:
+
},
{"results":[
+
...
        {
+
],
  "to_user_id":11075,
+
"since_id":0,
          "to_user":"ABC","  
+
"max_id":4192745203,
          "id":3147662,
+
"results_per_page":0,
  "from_user_id":1691463620,
+
"next_page":"?page=2&max_id=1291869235&q=王若琳",
          "from_user":"ABC4812",
+
"refresh_url":"?since_id=1291874240&q=王若琳",
          "iso_language_code":"nl",
+
"completed_in":0.24699999392032623,
          "source":"\"<a href=\\\"http://news.sina.com.cn/wap/wbk.html/\\\" rel=\\\"nofollow\\\">新浪微博手机版</a>\"",
+
"page":1,"query":"王若琳"
          "created_at":"Mon Feb 08 15:43:22 +0800 2010"}],
+
}
  "since_id":0,
+
</pre>
  "max_id":3147662,
+
===JSON示例(callback=foo)===
  "results_per_page":15,
+
<pre>
  "next_page":"",
+
foo(
  "refresh_url":"",
+
{
  "completed_in":0.19699999690055847,
+
"results":[
  "page":1,
+
{
  "query":"abc"}
+
"to_user_id":1728647563,
 
+
"to_user":"kiroro恋",
=== 使用示例===
+
"text":"喜欢坐在你的车里听王若琳的歌",
 
+
"id":4192745203,
* json:
+
"from_user_id":1728647563,
curl http://api.t.sina.com.cn/search.json?q=api
+
"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
api评价