POST/:user/lists/:list id

跳转到: 导航, 搜索
(创建新页面为 '==:user/lists/:id == 更新list ===URL=== http://api.t.sina.com.cn/:user/lists/:id.format ===格式=== xml, json ===HTTP请求方式=== POST, PUT ===是否需要登录==…')
 
(:user/lists/:list_id)
 
(未显示2个用户的19个中间版本)
第1行: 第1行:
==:user/lists/:id ==
+
==:user/lists/:list_id ==
更新list
+
更新指定的list。
 +
==URL==
 +
http://api.t.sina.com.cn/:user/lists/:list_id.format
 
   
 
   
===URL===
+
==格式==
http://api.t.sina.com.cn/:user/lists/:id.format
+
+
===格式===
+
 
xml, json
 
xml, json
 
   
 
   
===HTTP请求方式===
+
==HTTP请求方式==
 
POST, PUT
 
POST, PUT
 
   
 
   
===是否需要登录===
+
==是否需要登录==
 
true
 
true
 
   
 
   
===请求数限制===
+
==请求数限制==
 
false
 
false
 
   
 
   
===请求参数===
+
==请求参数==
* name: 可选参数。10个汉字的长度(20个字符的长度),汉字、字母,横线(不能用下划线),其他字符自动替换成横线,名称不能重复。
+
* name: 必选参数。10个汉字的长度(20个字符的长度),汉字、字母,横线(不能用下划线),其他字符自动替换成横线,名称不能重复。
:o 示例 http://api.t.sina.com.cn/openapi/lists/:id.xml?name=Marcel Molina
+
* description:可选参数。70个汉字。可填写全角、半角符号。只有公有list才有此内容。
* mode:可选参数。无论你的list是公开或私人,其值(values)可以是public或private。如果list明确规定mode, 将默认为public。
+
:o 示例 http://api.t.sina.com.cn/openapi/lists/:id.xml?mode=private
+
* description:可选参数。70个汉字。可填写全角、半角符号。
+
:o 示例 http://api.t.sina.com.cn/openapi/lists/:id.xml?description=描述内容
+
  
===返回结果===
+
==使用示例==
XML示例:
+
====XML====
<?xml version="1.0" encoding="UTF-8"?>
+
curl -u uid:password -d "source=appkey&name=newlist" http://api.t.sina.com.cn/testuser/lists/testlist.xml
<statuses>
+
<status>
+
    <created_at>Fri Dec 25 12:59:53 +0800 2009</created_at>
+
    <id>7470</id>
+
    <text>@37762 社会犹如一条船,每个人都要有掌舵的准备</text>
+
    <source>
+
      <a id="0" href="http://t.sina.com.cn">Web</a>
+
    </source>
+
    <favorited>false</favorited>
+
    <truncated>false</truncated>
+
    <geo/>
+
    <in_reply_to_status_id></in_reply_to_status_id>
+
    <in_reply_to_user_id></in_reply_to_user_id>
+
    <in_reply_to_screen_name></in_reply_to_screen_name>
+
    <thumbnail_pic>http://static16.photo.sina.com.cn/thumbnail/62988d06tcbbc377f7bbf</thumbnail_pic>
+
    <bmiddle_pic>http://static16.photo.sina.com.cn/bmiddle/62988d06tcbbc377f7bbf</bmiddle_pic>
+
    <original_pic>http://static16.photo.sina.com.cn/orignal/62988d06tcbbc377f7bbf</original_pic>
+
    <user>
+
      <id>37762</id>
+
      <screen_name>37762</screen_name>
+
      <name>name_37762</name>
+
      <province></province>
+
      <city></city>
+
      <location></location>
+
      <description></description>
+
      <url>http://timyang.net</url>
+
      <profile_image_url>http://tp4.sinaimg.cn/10503/50/0</profile_image_url>
+
      <domain>10503</domain>
+
      <gender></gender>
+
      <followers_count>20</followers_count>
+
      <friends_count>30</friends_count>
+
      <statuses_count>0</statuses_count>
+
      <favourites_count>0</favourites_count>
+
      <created_at>Thu Jan 01 08:00:00 +0800 1970</created_at>
+
      <following>false</following>
+
      <verified>false</verified>
+
      <geo_enabled>false</geo_enabled>
+
    </user>
+
  </status>
+
... truncated ...
+
</statuses>
+
  
JSON示例:
+
====Json====
 +
curl -u uid:password -d "source=appkey&name=newlist" http://api.t.sina.com.cn/testuser/lists/testlist.json
  
  [
+
==返回结果==
    {"created_at":"Thu Jan 07 11:43:19 +0800 2010",
+
====XML====
    "id":142304,
+
<pre>
    "text":"ttfffff @name_11075  ashttp://sinaurl.cn/hi4se f",
+
<?xml version="1.0" encoding="UTF-8"?>
    "source":"<a id=\"0\" href=\"http://t.sina.com.cn/\" rel=\"nofollow\">Web</a>",
+
<list>
    "favorited":false,
+
  <id>343</id>
     "truncated":false,
+
  <name>newlist</name>
    "in_reply_to_status_id":"",
+
  <full_name>@testuser/newlist</full_name>
    "in_reply_to_user_id":"",
+
  <slug>testuser</slug>
    "in_reply_to_screen_name":"",
+
  <description/>
    "geo":null,
+
  <subscriber_count>0</subscriber_count>
    "user":<br>       {"id":10506,
+
  <member_count>0</member_count>
        "screen_name":"name_10506",
+
  <uri>/testuser/newlist</uri>
        "name":"name_10506",
+
  <mode>public</mode>
        "province":"0",
+
  <user>
        "city":"0",
+
     <id>1642466141</id>
        "location":"",
+
    <screen_name>testuser</screen_name>
        "description":"",
+
    <name>testuser</name>
        "url":"",
+
    <province>11</province>
        "profile_image_url":"http://tp3.sinaimg.cn/10506/50/0",
+
    <city>8</city>
        "domain":"10506",
+
    <location>北京 海淀区</location>
        "followers_count":24,
+
    <description></description>
        "friends_count":50,
+
    <url>http://tuoniao.org</url>
        "statuses_count":0,
+
    <profile_image_url>http://tp2.sinaimg.cn/1642466141/50/1281523744</profile_image_url>
        "favourites_count":36,
+
    <domain>testuser</domain>
        "created_at":"Thu Jan 01 08:00:00 +0800 1970",
+
    <gender>m</gender>
        "following":false,
+
    <followers_count>41</followers_count>
        "geo_enabled":false,
+
    <friends_count>55</friends_count>
        "verified":false}
+
    <statuses_count>43</statuses_count>
     }<br/>   ,{}<br/>   ...<br/> ]
+
    <favourites_count>0</favourites_count>
 +
    <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
 +
    <following>false</following>
 +
    <verified>false</verified>
 +
    <allow_all_act_msg>false</allow_all_act_msg>
 +
     <geo_enabled>false</geo_enabled>
 +
  </user>
 +
</list>
 +
</pre>
  
===使用示例===
+
====Json====
需修改appkey
+
* xml:
+
curl -u uid:password http://api.t.sina.com.cn/statuses/mentions.xml?source=appkey
+
 
+
* json:
+
curl -u uid:password http://api.t.sina.com.cn/statuses/mentions.json?source=appkey
+
 
+
====Java示例====
+
请从 [[SDK | 微博SDK开发包下载]] 下载Java SDK<br>
+
代码示意如下:
+
package weibo4j.examples;
+
+
import java.util.List;
+
import weibo4j.Status;
+
import weibo4j.Weibo;
+
+
public class GetMentions {
+
+
/**
+
* 获取@当前用户的微博列表
+
* @param args
+
*/
+
public static void main(String[] args) {
+
System.setProperty("weibo4j.oauth.consumerKey", Weibo.CONSUMER_KEY);
+
    System.setProperty("weibo4j.oauth.consumerSecret", Weibo.CONSUMER_SECRET);
+
        try {
+
        Weibo weibo = getWeibo(true,args);
+
        List<Status> list = weibo.getMentions();
+
        for(Status status : list) {
+
        System.out.println( status.getId() + "  : "+status.getText());
+
        }
+
} catch (Exception e) {
+
e.printStackTrace();
+
}
+
}
+
+
private static Weibo getWeibo(boolean isOauth,String ... args) {
+
Weibo weibo = new Weibo();
+
if(isOauth) {//oauth验证方式 args[0]:访问的token;args[1]:访问的密匙
+
weibo.setToken(args[0], args[1]);
+
}else {//用户登录方式
+
    weibo.setUserId(args[0]);//用户名/ID
+
    weibo.setPassword(args[1]);//密码
+
}
+
return weibo;
+
}
+
}
+
====PHP示例====
+
请从 [[SDK | 微博SDK开发包下载]] 处下载PHP SDK(支持OAuth验证之版本)<br>
+
代码示例如下:
+
 
<pre>
 
<pre>
//Statuses/mentions
+
{
//获取@当前用户的微博列表
+
    "description": "",
$c = new WeiboClient( WB_AKEY ,  
+
    "full_name": "@testuser/newlist",
                      WB_SKEY ,  
+
    "id": 343,  
                      $_SESSION['last_key']['oauth_token'] ,  
+
    "member_count": 0,  
                      $_SESSION['last_key']['oauth_token_secret']  );
+
    "mode": "public",  
$msg  = $c->mentions();
+
    "name": "newlist",
if($msg === false || $msg === null) {
+
    "slug": "newlist",
echo "error occured";
+
    "subscriber_count": 0,
return false;
+
    "uri": "/testuser/newlist",
}
+
    "user": {
if (isset($msg['error_code']) && isset($msg['error'])){
+
        "allow_all_act_msg": false,
echo ('Error_code: '.$msg['error_code'].';  Error: '.$msg['error'] );
+
        "city": "8",
return false;
+
        "created_at": "Fri Aug 28 00:00:00 +0800 2009",
}
+
        "description": "\u53ef\u60b2\u7684\u4e2d\u56fd\u4e92\u8054\u7f51\u4ece\u4e1a\u8005\uff0c\u4e0d\u660e\u771f\u76f8\u7684\u7fa4\u4f17\u3002",
foreach ($msg as $data){
+
        "domain": "testuser",
$id = $data['id'];
+
        "favourites_count": 0,
$text = $data['text'];
+
        "followers_count": 41,
echo $id."=".$text.";";
+
        "following": false,
 +
        "friends_count": 55,
 +
        "gender": "m",
 +
        "geo_enabled": false,
 +
        "id": 1642466141,
 +
        "location": "\u5317\u4eac \u6d77\u6dc0\u533a",
 +
        "name": "testuser",
 +
        "profile_image_url": "http://tp2.sinaimg.cn/1642466141/50/1281523744",
 +
        "province": "11",
 +
        "screen_name": "testuser",
 +
        "statuses_count": 43,
 +
        "url": "http://tuoniao.org",
 +
        "verified": false
 +
    }
 
}
 
}
 
</pre>
 
</pre>

2010年12月24日 (五) 16:39的最后版本

目录

:user/lists/:list_id

更新指定的list。

URL

http://api.t.sina.com.cn/:user/lists/:list_id.format

格式

xml, json

HTTP请求方式

POST, PUT

是否需要登录

true

请求数限制

false

请求参数

  • name: 必选参数。10个汉字的长度(20个字符的长度),汉字、字母,横线(不能用下划线),其他字符自动替换成横线,名称不能重复。
  • description:可选参数。70个汉字。可填写全角、半角符号。只有公有list才有此内容。

使用示例

XML

curl -u uid:password -d "source=appkey&name=newlist" http://api.t.sina.com.cn/testuser/lists/testlist.xml

Json

curl -u uid:password -d "source=appkey&name=newlist" http://api.t.sina.com.cn/testuser/lists/testlist.json

返回结果

XML

<?xml version="1.0" encoding="UTF-8"?>
<list>
  <id>343</id>
  <name>newlist</name>
  <full_name>@testuser/newlist</full_name>
  <slug>testuser</slug>
  <description/>
  <subscriber_count>0</subscriber_count>
  <member_count>0</member_count>
  <uri>/testuser/newlist</uri>
  <mode>public</mode>
  <user>
    <id>1642466141</id>
    <screen_name>testuser</screen_name>
    <name>testuser</name>
    <province>11</province>
    <city>8</city>
    <location>北京 海淀区</location>
    <description></description>
    <url>http://tuoniao.org</url>
    <profile_image_url>http://tp2.sinaimg.cn/1642466141/50/1281523744</profile_image_url>
    <domain>testuser</domain>
    <gender>m</gender>
    <followers_count>41</followers_count>
    <friends_count>55</friends_count>
    <statuses_count>43</statuses_count>
    <favourites_count>0</favourites_count>
    <created_at>Fri Aug 28 00:00:00 +0800 2009</created_at>
    <following>false</following>
    <verified>false</verified>
    <allow_all_act_msg>false</allow_all_act_msg>
    <geo_enabled>false</geo_enabled>
  </user>
</list>

Json

{
    "description": "", 
    "full_name": "@testuser/newlist", 
    "id": 343, 
    "member_count": 0, 
    "mode": "public", 
    "name": "newlist", 
    "slug": "newlist", 
    "subscriber_count": 0, 
    "uri": "/testuser/newlist", 
    "user": {
        "allow_all_act_msg": false, 
        "city": "8", 
        "created_at": "Fri Aug 28 00:00:00 +0800 2009", 
        "description": "\u53ef\u60b2\u7684\u4e2d\u56fd\u4e92\u8054\u7f51\u4ece\u4e1a\u8005\uff0c\u4e0d\u660e\u771f\u76f8\u7684\u7fa4\u4f17\u3002", 
        "domain": "testuser", 
        "favourites_count": 0, 
        "followers_count": 41, 
        "following": false, 
        "friends_count": 55, 
        "gender": "m", 
        "geo_enabled": false, 
        "id": 1642466141, 
        "location": "\u5317\u4eac \u6d77\u6dc0\u533a", 
        "name": "testuser", 
        "profile_image_url": "http://tp2.sinaimg.cn/1642466141/50/1281523744", 
        "province": "11", 
        "screen_name": "testuser", 
        "statuses_count": 43, 
        "url": "http://tuoniao.org", 
        "verified": false
    }
}
文档更新时间: 2010-12-24