Blocks/create

跳转到: 导航, 搜索
(创建新页面为 '== blocks/create == Blocks the user specified in the ID parameter as the authenticating user. Destroys a friendship to the blocked user if it exists. Returns the blocked user in…')
 
 
(未显示2个用户的21个中间版本)
第1行: 第1行:
== blocks/create ==
+
{{api_desc2|
Blocks the user specified in the ID parameter as the authenticating user. Destroys a friendship to the blocked user if it exists. Returns the blocked user in the requested format when successful.  You can find out more about blocking in the Twitter Support Knowledge Base.
+
uri=blocks/create|
 
+
desc=将某用户加入登录用户的黑名单|
=== URL: ===
+
format=XML/JSON|
http://api.t.sina.com.cn/blocks/create/id.format
+
httpMethod=POST|
+
needAuth=true|
===Formats:===
+
rateLimit=true|
xml, json
+
params={{api_args|user_id|true|int64|要加入黑名单的用户ID}}
+
{{api_args|screen_name|false|string|要加入黑名单的用户微博昵称}}|
=== HTTP Method(s): ===
+
getParam=|
POST
+
postParam=-d "user_id=12345"|
+
result=
===Requires Authentication (about authentication):===
+
===XML示例===
true
+
<pre>
 
+
<?xml version="1.0" encoding="UTF-8"?>
===API rate limited (about rate limiting):===
+
<user>
false
+
  <id>12345</id>
 
+
  <screen_name>a12bcdc_h8f</screen_name>
===Parameters:===
+
  <name>a12bcdc_h8f</name>
One of the following is required:
+
  <province>0</province>
* id.  Optional.  The ID or screen_name of the potentially blocked user.
+
  <city>0</city>
o Example: http://api.t.sina.com.cn/blocks/create/bob.xml
+
  <location/>
* user_id.  Optional.  Specfies the ID of the potentially blocked user. Helpful for disambiguating when a valid user ID is also a valid screen name.
+
  <description/>
o Example: http://api.t.sina.com.cn/blocks/create.xml?user_id=1401881
+
  <url/>
* screen_name.  Optional.  Specfies the screen name of the potentially blocked user. Helpful for disambiguating when a valid screen name is also a user ID.
+
  <profile_image_url>http://tp2.sinaimg.cn/12345/50/0/0</profile_image_url>
o Example: http://api.t.sina.com.cn/blocks/create.xml?screen_name=101010
+
  <domain/>
 
+
  <gender>f</gender>
===Response (about return values): ===
+
  <followers_count>2</followers_count>
XML example (truncated):
+
  <friends_count>0</friends_count>
<?xml version="1.0" encoding="UTF-8"?>
+
  <statuses_count>0</statuses_count>
<user>
+
  <favourites_count>0</favourites_count>
<id>1401881</id>
+
  <created_at>Tue Dec 15 00:00:00 +0800 2009</created_at>
<name>Doug Williams</name>
+
  <following>false</following>
<screen_name>dougw</screen_name>
+
  <verified>false</verified>
<location>San Francisco, CA</location>
+
  <allow_all_act_msg>false</allow_all_act_msg>
<description>Twitter API Support. Internet, greed, users, dougw and opportunities are my passions.</description>
+
  <geo_enabled>true</geo_enabled>
<profile_image_url>http://s3.amazonaws.com/twitter_production/profile_images/59648642/avatar_normal.png</profile_image_url>
+
</user>
<url>http://www.igudo.com</url>
+
</pre>
<protected>false</protected>
+
===JSON示例===
<followers_count>1031</followers_count>
+
<pre>
<profile_background_color>9ae4e8</profile_background_color>
+
{
<profile_text_color>000000</profile_text_color>
+
    "name" : "a12bcdc_h8f",
<profile_link_color>0000ff</profile_link_color>
+
    "domain" : "",
<profile_sidebar_fill_color>e0ff92</profile_sidebar_fill_color>
+
    "geo_enabled" : true,
<profile_sidebar_border_color>87bc44</profile_sidebar_border_color>
+
    "followers_count" : 2,
<friends_count>293</friends_count>
+
    "statuses_count" : 0,
<created_at>Sun Mar 18 06:42:26 +0000 2007</created_at>
+
    "favourites_count" : 0,
<favourites_count>0</favourites_count>
+
    "city" : "0",
<utc_offset>-18000</utc_offset>
+
    "description" : "",
<time_zone>Eastern Time (US & Canada)</time_zone>
+
    "verified" : false,
<profile_background_image_url>http://s3.amazonaws.com/twitter_production/profile_background_images/2752608/twitter_bg_grass.jpg</profile_background_image_url>
+
    "id" : 12345,
<profile_background_tile>false</profile_background_tile>
+
    "gender" : "f",
<statuses_count>3390</statuses_count>
+
    "friends_count" : 0,
<notifications>false</notifications>
+
    "screen_name" : "a12bcdc_h8f",
<following>false</following>
+
    "allow_all_act_msg" : false,
<verified>true</verified>
+
    "following" : false,
<status>
+
    "url" : "",
<created_at>Tue Apr 07 22:52:51 +0000 2009</created_at>
+
    "profile_image_url" : "http://tp2.sinaimg.cn/12345/50/0/0",
<id>1472669360</id>
+
    "created_at" : "Tue Dec 15 00:00:00 +0800 2009",
<text>At least I can get your humor through tweets. RT @abdur: I don't mean this in a bad way, but genetically speaking your a cul-de-sac.</text>
+
    "province" : "0",
<source><a href="http://www.tweetdeck.com/">TweetDeck</a></source>
+
    "location" : ""
<truncated>false</truncated>
+
}
<in_reply_to_status_id></in_reply_to_status_id>
+
</pre>
<in_reply_to_user_id></in_reply_to_user_id>
+
{{Param_user}}|
<favorited>false</favorited>
+
useAge=
<in_reply_to_screen_name></in_reply_to_screen_name>
+
如果user_id或者screen_name均未提供,则返回400错误。|
</status>
+
otherInfo=无
</user>
+
}}
 
+
===Usage examples: ===
+
cURL (about cURL):
+
 
+
curl -d "" http://api.t.sina.com.cn/blocks/create/dougw.xml
+

2012年9月24日 (一) 11:44的最后版本

目录

blocks/create

将某用户加入登录用户的黑名单

URL

http://api.t.sina.com.cn/blocks/create.(json%7Cxml)

支持格式

XML/JSON

HTTP请求方式

POST

是否需要登录

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

请求数限制

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

请求参数

  必选 类型及范围 说明
source true string 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数)
user_id true int64 要加入黑名单的用户ID
screen_name false string 要加入黑名单的用户微博昵称

注意事项

如果user_id或者screen_name均未提供,则返回400错误。

返回结果

XML示例

<?xml version="1.0" encoding="UTF-8"?>
<user>
  <id>12345</id>
  <screen_name>a12bcdc_h8f</screen_name>
  <name>a12bcdc_h8f</name>
  <province>0</province>
  <city>0</city>
  <location/>
  <description/>
  <url/>
  <profile_image_url>http://tp2.sinaimg.cn/12345/50/0/0</profile_image_url>
  <domain/>
  <gender>f</gender>
  <followers_count>2</followers_count>
  <friends_count>0</friends_count>
  <statuses_count>0</statuses_count>
  <favourites_count>0</favourites_count>
  <created_at>Tue Dec 15 00:00:00 +0800 2009</created_at>
  <following>false</following>
  <verified>false</verified>
  <allow_all_act_msg>false</allow_all_act_msg>
  <geo_enabled>true</geo_enabled>
</user>

JSON示例

{
    "name" : "a12bcdc_h8f",
    "domain" : "",
    "geo_enabled" : true,
    "followers_count" : 2,
    "statuses_count" : 0,
    "favourites_count" : 0,
    "city" : "0",
    "description" : "",
    "verified" : false,
    "id" : 12345,
    "gender" : "f",
    "friends_count" : 0,
    "screen_name" : "a12bcdc_h8f",
    "allow_all_act_msg" : false,
    "following" : false,
    "url" : "",
    "profile_image_url" : "http://tp2.sinaimg.cn/12345/50/0/0",
    "created_at" : "Tue Dec 15 00:00:00 +0800 2009",
    "province" : "0",
    "location" : ""
}

字段说明 - user

  • id: 用户UID
  • screen_name: 微博昵称
  • name: 友好显示名称,同微博昵称
  • province: 省份编码(参考省份编码表)
  • city: 城市编码(参考城市编码表)
  • location:地址
  • description: 个人描述
  • url: 用户博客地址
  • profile_image_url: 自定义图像
  • domain: 用户个性化URL
  • gender: 性别,m--男,f--女,n--未知
  • followers_count: 粉丝数
  • friends_count: 关注数
  • statuses_count: 微博数
  • favourites_count: 收藏数
  • created_at: 创建时间
  • following: 是否已关注(此特性暂不支持)
  • verified: 加V标示,是否微博认证用户

其他

文档更新时间: 2012-09-24