新浪旧版开发文档地址:http://open.weibo.com/wiki/Short_url/shorten

新浪短网址接口的稳定性和跳转速度还是很给力的,现给出其API说明。

该接口支持两种返回格式:xml和json

 

对应的URL请求地址为:

  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:需要转换的长链接

举个例子

QQ截图20150203114644.png

xml:http://api.t.sina.com.cn/short_url/shorten.xml?source=123456789&url_long=http://www.cnblogs.com/e241138

 

返回内容为:


<urls>  <url>  <url_short>http://t.cn/zWXySpZ</url_short>  <url_long>http://www.cnblogs.com/e241138</url_long>  < type>0</type>  </url> </urls>

 

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}]



特别提示:短地址服务现在仅对已经认证的APP KEY提供服务,刚申请的APP KEY会被提示无权限。大家可以使用209678993和3818214747两个KEY做测试,这2个KEY来历不明,不建议用于生产。

版权声明:若无特殊注明,本文皆为( yueshuo )原创,转载请保留文章出处。