Weibo/show

出自天涯开放平台资源

跳转到: 导航, 搜索

目录

weibo/show

获取某条微博的信息

URL

http://open.tianya.cn/api/weibo/show.php

支持格式

XML/JSON

HTTP请求方式

POST/GET

是否需要登录

true,关于授权机制,参见OAuth相关说明

请求数限制

true,关于请求数限制,参见OAuth相关说明

请求参数

  必选 类型及范围 说明
appkey true string 申请应用时分配的appkey,调用接口时候代表应用的唯一身份
oauth_token true string 授权成功后所获得的 oauth_token
oauth_token_secret true string 授权成功后所获得的oauth_token_secret
timestamp true string 请求时候产生的时间戳time()
tempkey true string strtoupper(md5($timestamp.$appkey.$oauth_token.$oauth_token_secret.$appsecret))
id true int 微博id
outformat false string 可选,返回数据格式,默认为json

注意事项

若取当前用信息错误,则返回400错误,提示:"error_code"=>"40002", "error_msg"=>"request data error若取当前用信息错误,则返回400错误,提示: "error_code"=>"40002", "error_msg"=>"request data error"

返回结果

XML示例

<?xml version="1.0" encoding="utf8"?><data><sharedUname></sharedUname><sharedStartype>0</sharedStartype><time>1314174793000</time><id>36888156</id><star>0</star><originContent>测试,erer,dff</originContent><sharedMedia></sharedMedia><sharedReplyCount>0</sharedReplyCount><shareCount>1</shareCount><url></url><sharedStarurl></sharedStarurl><body></body><sharedId>0</sharedId><startype>0</startype><medias><image><item id="0"><sUrl>http://img3.laibafile.cn/getimgLMS/small/76894725.jpg</sUrl><lUrl>http://img3.laibafile.cn/getimgLMS/large/76894725.jpg</lUrl><mUrl>http://img3.laibafile.cn/getimgLMS/middle/76894725.jpg</mUrl></item></image></medias><sharedStar>0</sharedStar><word>测试,erer,dff</word><sharedTitle></sharedTitle><uid>51218315</uid><media>image|image/*|http://img3.laibafile.cn/getimgLMS/small/76894725.jpg;http://img3.laibafile.cn/getimgLMS/middle/76894725.jpg;http://img3.laibafile.cn/getimgLMS/large/76894725.jpg,</media><from>来自天涯开放平台</from><uname>opentest</uname><stardesc></stardesc><sharedUid>0</sharedUid><sharedShareCount>0</sharedShareCount><starurl></starurl><replyCount>102</replyCount><sharedMedias></sharedMedias><sharedStardesc></sharedStardesc></data><result>1</result><error></error>

JSON示例

 {"data":{"sharedUname":"","sharedStartype":0,"time":1314174793000,"id":36888156,"star":0,"originContent":"测试,erer,dff","sharedMedia":"","sharedReplyCount":0,"shareCount":1,"url":"","sharedStarurl":"","body":"","sharedId":0,"startype":0,"medias":{"image":[{"sUrl":"http://img3.laibafile.cn/getimgLMS/small/76894725.jpg","lUrl":"http://img3.laibafile.cn/getimgLMS/large/76894725.jpg","mUrl":"http://img3.laibafile.cn/getimgLMS/middle/76894725.jpg"}]},"sharedStar":0,"word":"测试,erer,dff","sharedTitle":"","uid":51218315,"media":"image|image/*|http://img3.laibafile.cn/getimgLMS/small/76894725.jpg;http://img3.laibafile.cn/getimgLMS/middle/76894725.jpg;http://img3.laibafile.cn/getimgLMS/large/76894725.jpg,","from":"来自天涯开放平台","uname":"opentest","stardesc":"","sharedUid":0,"sharedShareCount":0,"starurl":"","replyCount":102,"sharedMedias":{},"sharedStardesc":""},"result":1,"error":""}

返回字段说明

   {   
   "result":"1",   
   "error":"",   
   "data":{   
        "id":"",//该条微博的id   
      "word":"说的不错", //该条微博的阐述   
      "time":"1280205001811", //该微博发布的时间   
    "from":"通过网页", //途径 来自论坛,来自博客,来自相册,通过网页,通过短信   
      "shareCount":"12", //该条微博的被转发次数   
       "replyCount":"23", //该条微博的被回复次数   
       "media":"", //如果是原创,原创引用的图片。   
       "mediaFlag":"",//原创时的多媒体类型   
     "uid":"",//该条微博作者id   
      "uname":"",//该条微博作者name   
      "star":"1",//1为牛人,0或没有为非牛人   
         
     "sharedId":"",//如果是转发,转发的微博id   
        "sharedUid":"", //被转发的作者   
       "sharedStar":"1",//1为牛人,0或没有为非牛人   
      "sharedUname":"", //被转发的作者   
       "sharedTitle":"", //被转发的微博的标题   
      "sharedMedia":"", //如果是转发,转发引用的图片。   
     "sharedMediaFlag":"",//被转发的多媒体类型   
     "sharedShareCount":"",//被转发次数   
      "sharedReplyCount":"" //被回复次数   
   }   
}

PHP示例

SDK下载

SDK下载
代码示例如下: 
include 'tyapi.php'; 
//参数设置 
$appkey=; 
$appsecret=;
$url = 'http://open.tianya.cn/api/weibo/show.php';
$param[‘outformat’]=xml;
$param[‘id’]=10;
$data = do_post($url,$appkey,$appsecret,$_SESSION["oauth_token"],$_SESSION["oauth_token_secret"],$param);
查看
个人工具
成功案例
帮助中心