Short url/shorten

跳转到: 导航, 搜索
(创建新页面为 '{{api_desc2| uri=short_url/shorten| desc=将一个或多个长链接转换成短链接| format=XML/JSON| httpMethod=GET| needAuth=false| rateLimit=true| params={{api_args|url_lo…')
 
第6行: 第6行:
 
needAuth=false|
 
needAuth=false|
 
rateLimit=true|
 
rateLimit=true|
params={{api_args|url_long|true|string|需要转换的长链接,需要URLencoded,最多不超过20个。多个参数的例子:url_long=aaa&url_long=bbb}}|
+
params={{api_args|url_long|true|string|需要转换的长链接,需要URLencoded,最多不超过20个。多个参数的例子:url_long=aaa&url_long=bbb}}
getParam=&count=5|
+
getParam=&url_long=hb6sz1&url_long=hbTPZw|
 
postParam=|
 
postParam=|
 
result=
 
result=
 
===XML示例===
 
===XML示例===
 
<pre>
 
<pre>
 
+
<urls>
 +
    <url>
 +
        <url_short>http://t.cn/h4DwT1</url_short>
 +
<url_long>http://finance.sina.com.cn/</url_long>
 +
        <type>0</type>
 +
    </url>
 +
    ...
 +
</urls>
 
</pre>
 
</pre>
 
===JSON示例===
 
===JSON示例===
 
<pre>
 
<pre>
 
+
[
 +
    {
 +
        ”url_short”: ”http://t.cn/h4DwT1”,
 +
        ”url_long”: ”http://finance.sina.com.cn/”,
 +
        ”type”: 0
 +
    },
 +
    ...
 +
]
 
</pre>
 
</pre>
{{Param_statues}}
 
{{Param_user}}|
 
 
useAge=无|
 
useAge=无|
otherInfo=
+
otherInfo=
 
}}
 
}}

2010年12月30日 (四) 16:12的版本

目录

short_url/shorten

将一个或多个长链接转换成短链接

URL

http://api.t.sina.com.cn/short_url/shorten.(json%7Cxml)

支持格式

XML/JSON

HTTP请求方式

GET

是否需要登录

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

请求数限制

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

请求参数

  必选 类型及范围 说明
source true string 申请应用时分配的AppKey,调用接口时候代表应用的唯一身份。(采用OAuth授权方式不需要此参数)
url_long true string {{{4}}}

getParam=&url_long=hb6sz1&url_long=hbTPZw

注意事项

{{{useAge}}}

返回结果

XML示例

<urls>
    <url>
        <url_short>http://t.cn/h4DwT1</url_short>
	<url_long>http://finance.sina.com.cn/</url_long>
        <type>0</type>
    </url>
    ...
</urls>

JSON示例

[
    {
        ”url_short”: ”http://t.cn/h4DwT1”,
        ”url_long”: ”http://finance.sina.com.cn/”,
        ”type”: 0
    },
    ...
]

useAge=无

其他