Statuses/search

跳转到: 导航, 搜索
(创建新页面为 '== searchmblog == 返回关键字匹配的微博。 === URL=== http://api.t.sina.com.cn/searchmblog.format === 格式=== xml, json === HTTP请求方式=== GET === 是否…')
 
 
(未显示4个用户的13个中间版本)
第1行: 第1行:
== searchmblog ==
+
{{api_desc2|
返回关键字匹配的微博。
+
uri=statuses/search|
 +
desc=返回与指定的一个或多个条件相匹配的微博。|
 +
format=XML/JSON|
 +
httpMethod=GET|
 +
needAuth=false|
 +
rateLimit=true|
 +
params={{api_args|q|false|string|搜索的关键字。必须进行[http://en.wikipedia.org/wiki/URL_encoding|URL Encode]}}
 +
{{api_args|filter_ori|false|int|过滤器,是否为原创,0为全部,5为原创,4为转发。默认为0。}}
 +
{{api_args|filter_pic|false|int|过滤器。是否包含图片。0为全部,1为包含,2为不包含。}}
 +
{{api_args|fuid|false|int64|微博作者的用户ID。}}
 +
{{api_args|province|false|int|省份ID,参考[[省份城市编码表]]}}
 +
{{api_args|city|false|int|城市ID,参考[[省份城市编码表]]}}
 +
{{api_args|starttime|false|number|开始时间,Unix时间戳}}
 +
{{api_args|endtime|false|number|结束时间,Unix时间戳}}
 +
{{api_args|page|false|int|页码}}
 +
{{api_args|count|false|int|每页返回的微博数。(默认返回10条,最大200条。)}}
 +
{{api_args|needcount|false|boolean|返回结果中是否包含返回记录数。true则返回搜索结果记录数。}}
 +
{{api_args|base_app|false|int|是否按照当前应用信息对搜索结果进行过滤。当值为1时,仅返回通过该应用发送的微博消息。}}
 +
{{api_args|callback|false|string|仅JSON方式支持,用于JSONP跨域数据访问。}}|
 +
getParam=&q=王若琳&callback=foo|
 +
postParam=|
 +
result=
 +
===XML示例===
 +
<pre>
 +
<?xml version="1.0" encoding="UTF-8"?>
 +
<searchResult>
 +
  <statuses>
 +
    <status>
 +
      <created_at>Mon Dec 13 10:07:46 +0800 2010</created_at>
 +
      <id>4281864911</id>
 +
      <text>鼓楼一家店播放着小野丽莎的歌,我误认为是王若琳,重温下若琳的“有你的快乐”。</text>
 +
      <source>
 +
        <a href="http://t.sina.com.cn">新浪微博</a>
 +
      </source>
 +
      <favorited>false</favorited>
 +
      <truncated>false</truncated>
 +
      <geo/>
 +
      <in_reply_to_status_id/>
 +
      <in_reply_to_user_id/>
 +
      <in_reply_to_screen_name/>
 +
      <user>
 +
        <id>1547460074</id>
 +
        <screen_name>谢炳碧浙温</screen_name>
 +
        <name>谢炳碧浙温</name>
 +
        <province>33</province>
 +
        <city>3</city>
 +
        <location>浙江 温州</location>
 +
        <description>团结一切可以团结的力量。</description>
 +
        <url>http://1</url>
 +
        <profile_image_url>http://tp3.sinaimg.cn/1547460074/50/1289882541/1</profile_image_url>
 +
        <domain/>
 +
        <gender>m</gender>
 +
        <followers_count>27</followers_count>
 +
        <friends_count>60</friends_count>
 +
        <statuses_count>37</statuses_count>
 +
        <favourites_count>0</favourites_count>
 +
        <created_at>Tue Nov 16 00:00:00 +0800 2010</created_at>
 +
        <following>false</following>
 +
        <verified>false</verified>
 +
        <allow_all_act_msg>false</allow_all_act_msg>
 +
        <geo_enabled>true</geo_enabled>
 +
      </user>
 +
      <annotations/>
 +
    </status>
 +
    ...
 +
  </statuses>
 +
</searchResult>
 +
</pre>
 +
===JSON示例(无callback参数)===
 +
<pre>
 +
[
 +
    {
 +
        "created_at" : "Mon Dec 13 10:07:46 +0800 2010",
 +
        "text" : "鼓楼一家店播放着小野丽莎的歌,我误认为是王若琳,重温下若琳的“有你的快乐”。",
 +
        "truncated" : false,
 +
        "in_reply_to_status_id" : "",
 +
        "annotations" :
 +
        [
  
=== URL===
+
        ],
http://api.t.sina.com.cn/searchmblog.format
+
        "in_reply_to_screen_name" : "",
+
        "geo" : null,
=== 格式===
+
        "user" :
xml, json
+
        {
+
            "name" : "谢炳碧浙温",
=== HTTP请求方式===
+
            "domain" : "",
GET
+
            "geo_enabled" : true,
+
            "followers_count" : 27,
=== 是否需要登录===
+
            "statuses_count" : 37,
true
+
            "favourites_count" : 0,
+
            "city" : "3",
=== 请求数限制===
+
            "description" : "团结一切可以团结的力量。",
true
+
            "verified" : false,
 +
            "id" : 1547460074,
 +
            "gender" : "m",
 +
            "friends_count" : 60,
 +
            "screen_name" : "谢炳碧浙温",
 +
            "allow_all_act_msg" : false,
 +
            "following" : false,
 +
            "url" : "http://1",
 +
            "profile_image_url" : "http://tp3.sinaimg.cn/1547460074/50/1289882541/1",
 +
            "created_at" : "Tue Nov 16 00:00:00 +0800 2010",
 +
            "province" : "33",
 +
            "location" : "浙江 温州"
 +
        },
 +
        "favorited" : false,
 +
        "in_reply_to_user_id" : "",
 +
        "id" : 4281864911,
 +
        "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
 +
    },
 +
    ...
 +
]
 +
</pre>
 +
===JSON示例(callback=foo)===
 +
<pre>
 +
foo(
 +
[
 +
    {
 +
"created_at" : "Mon Dec 13 10:07:46 +0800 2010",
 +
"text" : "鼓楼一家店播放着小野丽莎的歌,我误认为是王若琳,重温下若琳的“有你的快乐”。",
 +
"truncated" : false,
 +
"in_reply_to_status_id" : "",
 +
"annotations" :
 +
[
  
===请求参数===
+
],
* q: 选填参数. 查询的关键字。必须进行[http://en.wikipedia.org/wiki/URL_encoding url encode]
+
"in_reply_to_screen_name" : "",
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api
+
"geo" : null,
* filter_ori: 选填参数.过滤器,是否原创  (0为全部,5为原创,4为转发,默认0)
+
"user" :  
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api&filter_ori=0
+
{
* filter_pic: 选填参数. 过滤器,是否含图  (0为全部,1为含图,2为不含图)
+
    "name" : "谢炳碧浙温",
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api&filter_pic=1
+
    "domain" : "",
* fuid: 选填参数. 微博作者UID
+
    "geo_enabled" : true,
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api&fuid=11075
+
    "followers_count" : 27,
* province: 省份ID
+
    "statuses_count" : 37,
:o 示例: http://api.t.sina.com.cn/searchmblog.json?province=11
+
    "favourites_count" : 0,
* city: 城市ID
+
    "city" : "3",
:o 示例: http://api.t.sina.com.cn/searchmblog.json?province=11&city=1
+
    "description" : "团结一切可以团结的力量。",
* starttime: 开始时间(unix时间戳)
+
    "verified" : false,
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api&starttime=1256289598
+
    "id" : 1547460074,
* endtime: 截止时间 (unix时间戳)
+
    "gender" : "m",
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api&endtime=1256289598
+
    "friends_count" : 60,
* page: 页码
+
    "screen_name" : "谢炳碧浙温",
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api&sort=1&page=1
+
    "allow_all_act_msg" : false,
* count:分页大小(默认返回10条)
+
    "following" : false,
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api&sort=1&page=1&count=10
+
    "url" : "http://1",
* callback: 可选参数. 仅JSON方式支持,用于JSONP callback作用。
+
    "profile_image_url" : "http://tp3.sinaimg.cn/1547460074/50/1289882541/1",
:o 示例: http://api.t.sina.com.cn/searchmblog.json?q=api&callback=foo
+
    "created_at" : "Tue Nov 16 00:00:00 +0800 2010",
 
+
    "province" : "33",
=== 返回结果 ===
+
    "location" : "浙江 温州"
XML示例:
+
},
 
+
"favorited" : false,
=== 使用示例===
+
"in_reply_to_user_id" : "",
 
+
"id" : 4281864911,
* xml:
+
"source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
curl http://api.t.sina.com.cn/searchmblog.xml?q=api
+
    },
 
+
    ...
* json:
+
]
curl http://api.t.sina.com.cn/searchmblog.json?q=api
+
)
 +
</pre>|
 +
useAge=无|
 +
otherInfo=
 +
}}{{#a:showgrade}}

2010年12月13日 (一) 10:13的最后版本

目录

statuses/search

返回与指定的一个或多个条件相匹配的微博。

URL

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

支持格式

XML/JSON

HTTP请求方式

GET

是否需要登录

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

请求数限制

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

请求参数

  必选 类型及范围 说明
source true string 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数)
q false string 搜索的关键字。必须进行[http://en.wikipedia.org/wiki/URL_encoding
filter_ori false int 过滤器,是否为原创,0为全部,5为原创,4为转发。默认为0。
filter_pic false int 过滤器。是否包含图片。0为全部,1为包含,2为不包含。
fuid false int64 微博作者的用户ID。
province false int 省份ID,参考省份城市编码表
city false int 城市ID,参考省份城市编码表
starttime false number 开始时间,Unix时间戳
endtime false number 结束时间,Unix时间戳
page false int 页码
count false int 每页返回的微博数。(默认返回10条,最大200条。)
needcount false boolean 返回结果中是否包含返回记录数。true则返回搜索结果记录数。
base_app false int 是否按照当前应用信息对搜索结果进行过滤。当值为1时,仅返回通过该应用发送的微博消息。
callback false string 仅JSON方式支持,用于JSONP跨域数据访问。

注意事项

返回结果

XML示例

<?xml version="1.0" encoding="UTF-8"?>
<searchResult>
  <statuses>
    <status>
      <created_at>Mon Dec 13 10:07:46 +0800 2010</created_at>
      <id>4281864911</id>
      <text>鼓楼一家店播放着小野丽莎的歌,我误认为是王若琳,重温下若琳的“有你的快乐”。</text>
      <source>
        <a href="http://t.sina.com.cn">新浪微博</a>
      </source>
      <favorited>false</favorited>
      <truncated>false</truncated>
      <geo/>
      <in_reply_to_status_id/>
      <in_reply_to_user_id/>
      <in_reply_to_screen_name/>
      <user>
        <id>1547460074</id>
        <screen_name>谢炳碧浙温</screen_name>
        <name>谢炳碧浙温</name>
        <province>33</province>
        <city>3</city>
        <location>浙江 温州</location>
        <description>团结一切可以团结的力量。</description>
        <url>http://1</url>
        <profile_image_url>http://tp3.sinaimg.cn/1547460074/50/1289882541/1</profile_image_url>
        <domain/>
        <gender>m</gender>
        <followers_count>27</followers_count>
        <friends_count>60</friends_count>
        <statuses_count>37</statuses_count>
        <favourites_count>0</favourites_count>
        <created_at>Tue Nov 16 00:00:00 +0800 2010</created_at>
        <following>false</following>
        <verified>false</verified>
        <allow_all_act_msg>false</allow_all_act_msg>
        <geo_enabled>true</geo_enabled>
      </user>
      <annotations/>
    </status>
    ...
  </statuses>
</searchResult>

JSON示例(无callback参数)

[
    {
        "created_at" : "Mon Dec 13 10:07:46 +0800 2010",
        "text" : "鼓楼一家店播放着小野丽莎的歌,我误认为是王若琳,重温下若琳的“有你的快乐”。",
        "truncated" : false,
        "in_reply_to_status_id" : "",
        "annotations" : 
        [

        ],
        "in_reply_to_screen_name" : "",
        "geo" : null,
        "user" : 
        {
            "name" : "谢炳碧浙温",
            "domain" : "",
            "geo_enabled" : true,
            "followers_count" : 27,
            "statuses_count" : 37,
            "favourites_count" : 0,
            "city" : "3",
            "description" : "团结一切可以团结的力量。",
            "verified" : false,
            "id" : 1547460074,
            "gender" : "m",
            "friends_count" : 60,
            "screen_name" : "谢炳碧浙温",
            "allow_all_act_msg" : false,
            "following" : false,
            "url" : "http://1",
            "profile_image_url" : "http://tp3.sinaimg.cn/1547460074/50/1289882541/1",
            "created_at" : "Tue Nov 16 00:00:00 +0800 2010",
            "province" : "33",
            "location" : "浙江 温州"
        },
        "favorited" : false,
        "in_reply_to_user_id" : "",
        "id" : 4281864911,
        "source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
    },
    ...
]

JSON示例(callback=foo)

foo(
	[
	    {
		"created_at" : "Mon Dec 13 10:07:46 +0800 2010",
		"text" : "鼓楼一家店播放着小野丽莎的歌,我误认为是王若琳,重温下若琳的“有你的快乐”。",
		"truncated" : false,
		"in_reply_to_status_id" : "",
		"annotations" : 
		[

		],
		"in_reply_to_screen_name" : "",
		"geo" : null,
		"user" : 
		{
		    "name" : "谢炳碧浙温",
		    "domain" : "",
		    "geo_enabled" : true,
		    "followers_count" : 27,
		    "statuses_count" : 37,
		    "favourites_count" : 0,
		    "city" : "3",
		    "description" : "团结一切可以团结的力量。",
		    "verified" : false,
		    "id" : 1547460074,
		    "gender" : "m",
		    "friends_count" : 60,
		    "screen_name" : "谢炳碧浙温",
		    "allow_all_act_msg" : false,
		    "following" : false,
		    "url" : "http://1",
		    "profile_image_url" : "http://tp3.sinaimg.cn/1547460074/50/1289882541/1",
		    "created_at" : "Tue Nov 16 00:00:00 +0800 2010",
		    "province" : "33",
		    "location" : "浙江 温州"
		},
		"favorited" : false,
		"in_reply_to_user_id" : "",
		"id" : 4281864911,
		"source" : "<a href=\"http://t.sina.com.cn\" rel=\"nofollow\">新浪微博</a>"
	    },
	    ...
	]
)

其他

文档更新时间: 2010-12-13
api评价