bit.ly兼容的API

现在很容易从bit.ly转换到safe.mn,clic.gs,go2.gs,cliks.fr或888.hn.我们新的API完全兼容bit.ly.

The bit.ly APi is described in details here. Replace bit.ly by safe.mn, clic.gs, go2.gs, cliks.fr or 888.hn.>范例:

http://api.bit.ly/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&longUrl=http%3A%2F%2Fbetaworks.com%2F&format=json

成为:

http://api.safe.mn/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&longUrl=http%3A%2F%2Fbetaworks.com%2F&format=json

或

http://api.safe.mn/v3/shorten?longUrl=http%3A%2F%2Fbetaworks.com%2F&format=json

Safe.mn无需API密钥或登录. 登录和API密钥的参数可以跳过,或者他们可以设置任何值

几个次要的bit.ly API调用是不支持的。下面的章节列出了Safe.mn和bit.ly API的不同之处.

如果你不需要bit.ly的兼容性,参见更强大的API.

支持的调用

不支持的调用

  • /v3/bitly_pro_domain
  • /v3/authenticate
  • /v3/info

支持的调用

详情请参见 官方的bit.ly API.

/v3/shorten

http://api.safe.mn/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&longUrl=http%3A%2F%2Fbetaworks.com%2F&format=json

或

http://api.safe.mn/v3/shorten?longUrl=http%3A%2F%2Fbetaworks.com%2F&format=json
参数必需的
login忽视的
apiKey忽视的
longUrl必需的
formatoptional

回复

{
 "status_code": 200,
 "data": {
 "url": "http://safe.mn/sLH",
 "hash": "sLH",
 "global_hash": "sLH",
 "long_url": "http://betaworks.com/",
 "new_hash": 1
 },
 "status_txt": "OK"
}

hash和global_hash始终保持相同的值。new_hash目前总是等于1.

顶部

支持的调用

详情请参见 官方的bit.ly API.

/v3/expand

http://api.safe.mn/v3/expand?shortUrl=http%3A%2F%2Fsafe.mn%2FsLH
&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&hash=sMe&hash=zzzzzzzzz&format=xml

或

http://api.safe.mn/v3/expand?shortUrl=http%3A%2F%2Fsafe.mn%2FsLK&shortUrl=http%3A%2F%2Fsafe.mn%2FsLH
&hash=sMe&hash=zzzzzzzzz&format=xml
参数必需的
login忽视的
apiKey忽视的
shortUrl or hash必需的
formatoptional

回复

<?xml version="1.0" encoding="UTF-8"?>
<response>
 <status_code>200</status_code>
 <status_txt>OK</status_txt>
 <data>
 <entry>
 <short_url>http://safe.mn/sLK</short_url>
 <long_url>http://www.techcrunch.com/2010/01/29/windows-mobile-foursquare/</long_url>
 <user_hash></user_hash>
 <global_hash>sLK</global_hash>
 </entry>
 <entry>
 <short_url>http://safe.mn/sLH</short_url>
 <long_url>http://betaworks.com/</long_url>
 <user_hash></user_hash>
 <global_hash>sLH</global_hash>
 </entry>
 <entry>
 <hash>sMe</hash>
 <long_url>http://www.scotster.com/qf/?1152</long_url>
 <user_hash></user_hash>
 <global_hash>sMe</global_hash>
 </entry>
 <entry>
 <error>NOT_FOUND</error>
 <hash>a35.</hash>
 </entry>
 </data>
</response>

hash和global_hash 始终保持相同的值. user_hash

顶部

支持的调用

详情请参见官方的bit.ly API.

/v3/validate

http://api.safe.mn/v3/validate?x_login=notbilytapi&x_apiKey=not_apikey&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07
&login=bitlyapidemo&format=json

或

http://api.safe.mn/v3/validate

该调用总是返回1. 所有参数都是可选的

顶部

支持的调用

详情请参见官方的bit.ly API.

/v3/clicks

http://api.safe.mn/v3/clicks?shortUrl=http%3A%2F%2Fsafe.mn%2FsLK&shortUrl=http%3A%2F%2Fsafe.mn%2FsLH
&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&hash=j3&hash=a35.&format=json

或

http://api.safe.mn/v3/clicks?shortUrl=http%3A%2F%2Fsafe.mn%2FsLK&shortUrl=http%3A%2F%2Fsafe.mn%2FsLH
&hash=j3&hash=a35.&format=json

回复

{
 "status_code": 200,
 "data": {
 "clicks": [
 {
 "short_url": "http://safe.mn/sLK",
 "global_hash": "sLK",
 "user_clicks": 1105,
 "user_hash": "",
 "global_clicks": 1105
 },
 {
 "short_url": "http://safe.mn/sLH",
 "global_hash": "sLH",
 "user_clicks": 2218,
 "user_hash": "",
 "global_clicks": 2218
 },
 {
 "hash": "j3",
 "global_hash": "j3",
 "user_clicks": 106,
 "user_hash": "",
 "global_clicks": 106
 },
 {
 "hash": "a35.",
 "error": "NOT_FOUND"
 }
 ]
 },
 "status_txt": "OK"
}

hash和global_hash始终保持相同的值。user_clicks和global_clicks始终保持相同。new_hash总是空值.

顶部

支持的调用

详情请参见 官方的bit.ly API.

/v3/lookup

http://api.safe.mn/v3/lookup?url=http%3A%2F%2Fbetaworks.com%2F&url=http%3A%2F%2Fcode.google.com%2Fp%2Fbitly-api%2F
&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&format=json

或

http://api.safe.mn/v3/lookup?url=http%3A%2F%2Fbetaworks.com%2F&url=http%3A%2F%2Fcode.google.com%2Fp%2Fbitly-api%2F
&format=json

回复

{
 "data": {
 "lookup": [
 {
 "global_hash": "sLH",
 "short_url": "http://safe.mn/sLH",
 "url": "http://betaworks.com/"
 },
 {
 "global_hash": "tto",
 "short_url": "http://safe.mn/tto",
 "url": "http://code.google.com/p/bitly-api/"
 }
 ]
 },
 "status_code": 200,
 "status_txt": "OK"
}

顶部