xml:http://api.t.sina.com.cn/short_url/shorten.xml
json:http://api.t.sina.com.cn/short_url/shorten.json
请求方式:GET
请求参数:
source:应用的appkey
url_long:需要转换的长链接
举个例子
xml:http://api.t.sina.com.cn/short_url/shorten.xml?source=123456789&url_long=http://www.cnblogs.com/e241138
返回内容为:
http://t.cn/zWXySpZ
http://www.cnblogs.com/e241138
json:http://api.t.sina.com.cn/short_url/shorten.json?source=123456789&url_long=http://www.cnblogs.com/e241138
返回内容为:
{"url_short":"http://t.cn/zWXySpZ","url_long":"http://www.cnblogs.com/e241138","type":0}
--------------------------------------分隔线(3月15日更新)-----------------------------------------------------------
新浪更新后的长网址转短网址官方API文档:http://open.weibo.com/wiki/2/short_url/shorten
调用地址:https://api.weibo.com/2/short_url/shorten.json
请求方式:GET
请求参数:
access_token: 授权后获得url_long: 待转换的长地址
返回结果:
"urls":
"url_short": "http://t.cn/h4DwT1",
"url_long": "http://finance.sina.com.cn/",
"type": 0,
"result": "true"
注意:每次使用时都需要access_token,而access_token是需要登录后授权才能得到的。如
果你想做一个短网址转换的应用,肯定不能要求用户先登录微博、授权、然后才能使用你的功能,这样用户体验太差。你可以在服务器端用个测试帐号定期授权来获
取access_token,这样就不需要用户登录微博授权了,用户可以直接输入长网址,获取转换后的短网址。
还没有评论,来说两句吧...