-
1
bit.ly API bit.ly API bit.ly
API
3.0
bit.ly REST API
API
bit.ly apiKey
http://bit.ly/a/sign_up
apiKey http://bit.ly/a/your_api_key
login=login&apiKey=apiKey
bitlyapidemo apiKey
bit.ly API
json xml txt
format=json
bit.ly API jsonp jsonp json
:
format=json&callback=callback_method
-
2
API api.bit.ly(
)
jsonxmlHTTP Response Status Code 200
json xml status_code status_txt
txt HTTP Response Status Code 403500 503
200 json xml status_txt
status_code 200 403
503 500
status_txt
URL MISSING_ARG_%s
INVALID_%s %s
json { "status_code": 200, "status_txt": "OK", "data" : ...
}
json { "status_code": 403, "status_txt":
"RATE_LIMIT_EXCEEDED",
"data" : null }
json { "status_code": 500, "status_txt": "INVALID_URI", "data" :
null }
json { "status_code": 500, "status_txt": "MISSING_ARG_LOGIN",
"data" :
null }
json { "status_code": 503, "status_txt": "UNKNOWN_ERROR", "data"
:
null }
jsonp callback_method({ "status_code": 200, "status_txt":
"OK",
"data" : ... })
xml
200
-
3
OK
...
bit.ly API IP
API IP
API
API
bit.lyAPI [email protected]
bit.ly API API
REST API
/v3/shorten
URL /v3/shorten URL URL
format json
xml txt
longUrl URL http://betaworks.com/
-
4
domain bit.ly j.mp url
x_login bit.ly
bit.ly
x_apiKey bit.ly
apiKey
bit.ly apiKey
URL URL & ? #
URL URL
URL URL
%20 +URL
URLURL
URL
http://example.com?query=parameter
http://example.com/?query=parameter
x_login x_apiKey x_login
URL login
new_hash URL 1
long_url
url link bit.ly
hash long_url bit.ly
global_hash long_url hash bit.ly
bit.ly
long_url longUrl URL
long_url
-
5
json
http://api.bit.ly/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0
a9118ff35f52f629d2d71bf07&longUrl=http%3A%2F%2Fbetaworks.com%2F&
format=json
{
"status_code": 200,
"data": {
"url": "http://bit.ly/cmeH01",
"hash": "cmeH01",
"global_hash": "1YKMfY",
"long_url": "http://betaworks.com/",
"new_hash": 0
},
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0
a9118ff35f52f629d2d71bf07&longUrl=http%3A%2F%2Fbetaworks.com%2F&
format=xml
200
OK
http://bit.ly/cmeH01
cmeH01
1YKMfY
http://betaworks.com/
0
txt
http://api.bit.ly/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0
-
6
a9118ff35f52f629d2d71bf07&longUrl=http%3A%2F%2Fbetaworks.com%2F&
format=txt
http://bit.ly/cmeH01
/v3/expand
bit.ly URL hash() /v3/expand URL
format json
xml txt
shortUrl bit.ly URL http://bit.ly/1RmnUT
http://j.mp/1RmnUT
hash bit.ly hash 2bYgqR
shortUrl hash
shortURL hash
short_url shortUrl
hash hash
user_hash bit.ly ID
global_hash URL bit.ly hash ID
error shortUrl hash
NOT_FOUND
long_url short_url hash URL
json
http://api.bit.ly/v3/expand?shortUrl=http%3A%2F%2Ftcrn.ch%2Fa4MS
UH&shortUrl=http%3A%2F%2Fbit.ly%2F1YKMfY&login=bitlyapidemo&apiK
-
7
ey=R_0da49e0a9118ff35f52f629d2d71bf07&hash=j3&hash=a35.&format=j
son
{
"status_code": 200,
"data": {
"expand": [
{
"short_url": "http://tcrn.ch/a4MSUH",
"global_hash": "bWw49z",
"long_url":
"http://www.techcrunch.com/2010/01/29/windows-mobile-foursquare/
",
"user_hash": "a4MSUH"
},
{
"short_url": "http://bit.ly/1YKMfY",
"global_hash": "1YKMfY",
"long_url": "http://betaworks.com/",
"user_hash": "1YKMfY"
},
{
"long_url": "http://www.scotster.com/qf/?1152",
"global_hash": "lLWr",
"hash": "j3",
"user_hash": "j3"
},
{
"hash": "a35.",
"error": "NOT_FOUND"
}
]
},
-
8
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/expand?shortUrl=http%3A%2F%2Ftcrn.ch%2Fa4MS
UH&shortUrl=http%3A%2F%2Fbit.ly%2F1YKMfY&login=bitlyapidemo&apiK
ey=R_0da49e0a9118ff35f52f629d2d71bf07&hash=j3&hash=a35.&format=x
ml
200
OK
http://tcrn.ch/a4MSUH
http://www.techcrunch.com/2010/01/29/window
s-mobile-foursquare/
a4MSUH
bWw49z
http://bit.ly/1YKMfY
http://betaworks.com/
1YKMfY
1YKMfY
j3
http://www.scotster.com/qf/?1152
j3
lLWr
NOT_FOUND
-
9
a35.
json
http://api.bit.ly/v3/expand?shortUrl=http%3A%2F%2Fbit.ly%2F31IqM
l&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&f
ormat=json
{
"status_code": 200,
"data": {
"expand": [
{
"short_url": "http://bit.ly/31IqMl",
"global_hash": "31IqMl",
"long_url": "http://cnn.com/",
"user_hash": "31IqMl"
}
]
},
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/expand?shortUrl=http%3A%2F%2Fbit.ly%2F31IqM
l&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&f
ormat=xml
200
OK
http://bit.ly/31IqMl
-
10
http://cnn.com/
31IqMl
31IqMl
txt
http://api.bit.ly/v3/expand?shortUrl=http%3A%2F%2Fbit.ly%2F31IqM
l&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&f
ormat=txt
http://cnn.com/
/v3/validate
bit.ly apiKey
format
json xml txt
x_login bit.ly ID
x_apiKey bit.ly apiKey
valid 0 1 x_login x_apiKey
json
http://api.bit.ly/v3/validate?x_login=notbilytapi&x_apiKey=not_a
pikey&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&login=bitlyapide
mo&format=json
{
"status_code": 200,
"data": {
-
11
"valid": 0
},
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/validate?x_login=notbilytapi&x_apiKey=not_a
pikey&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&login=bitlyapide
mo&format=xml
200
OK
0
txt
http://api.bit.ly/v3/validate?x_login=notbilytapi&x_apiKey=not_a
pikey&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&login=bitlyapide
mo&format=txt
0
/v3/clicks
bit.ly URL hash
format
json xml
shortUrl bit.ly URL http://bit.ly/1RmnUT
http://j.mp/1RmnUT
-
12
hash bit.ly hash 2bYgqR
shortUrl hash
shortURL hash
short_url shortUrl
hash hash
user_hash bit.ly ID
global_hash URL bit.ly hash ID
user_clicks bit.ly
global_clicks URL bit.ly
error shortUrl hash
NOT_FOUND
json
http://api.bit.ly/v3/clicks?shortUrl=http%3A%2F%2Ftcrn.ch%2Fa4MS
UH&shortUrl=http%3A%2F%2Fbit.ly%2F1YKMfY&login=bitlyapidemo&apiK
ey=R_0da49e0a9118ff35f52f629d2d71bf07&hash=j3&hash=a35.&format=j
son
{
"status_code": 200,
"data": {
"clicks": [
{
"short_url": "http://tcrn.ch/a4MSUH",
"global_hash": "bWw49z",
"user_clicks": 0,
"user_hash": "a4MSUH",
"global_clicks": 1105
},
{
-
13
"short_url": "http://bit.ly/1YKMfY",
"global_hash": "1YKMfY",
"user_clicks": 2218,
"user_hash": "1YKMfY",
"global_clicks": 2218
},
{
"hash": "j3",
"global_hash": "lLWr",
"user_clicks": 105,
"user_hash": "j3",
"global_clicks": 106
},
{
"hash": "a35.",
"error": "NOT_FOUND"
}
]
},
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/clicks?shortUrl=http%3A%2F%2Ftcrn.ch%2Fa4MS
UH&shortUrl=http%3A%2F%2Fbit.ly%2F1YKMfY&login=bitlyapidemo&apiK
ey=R_0da49e0a9118ff35f52f629d2d71bf07&hash=j3&hash=a35.&format=x
ml
200
http://tcrn.ch/a4MSUH
bWw49z
-
14
0
a4MSUH
1105
http://bit.ly/1YKMfY
1YKMfY
2218
1YKMfY
2218
105
lLWr
j3
j3
106
a35.
NOT_FOUND
OK
/v3/bitly_pro_domain
-
15
bitly.Pro
apishortUrl
bitly.Pro
domain nyti.ms
format
json xml
bitly_pro_domain 0 1 bitly.Pro
domain
json
http://api.bit.ly/v3/bitly_pro_domain?domain=nyti.ms&apiKey=R_0d
a49e0a9118ff35f52f629d2d71bf07&login=bitlyapidemo&format=json
{
"status_code": 200,
"data": {
"domain": "nyti.ms",
"bitly_pro_domain": 1
},
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/bitly_pro_domain?domain=nyti.ms&apiKey=R_0d
a49e0a9118ff35f52f629d2d71bf07&login=bitlyapidemo&format=xml
200
nyti.ms
1
-
16
OK
/v3/lookup
URL bit.ly UR
/v3/lookup/v3/clicks
url URL
format
json xml
url 15
url url
short_url bit.ly
json
http://api.bit.ly/v3/lookup?url=http%3A%2F%2Fbetaworks.com%2F&ur
l=http%3A%2F%2Fcode.google.com%2Fp%2Fbitly-api%2F&login=bitlyapi
demo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&format=json
{
"data": {
"lookup": [
{
"global_hash": "beta",
"short_url": "http://bit.ly/beta",
"url": "http://betaworks.com/"
},
{
-
17
"global_hash": "1oDCU",
"short_url": "http://bit.ly/1oDCU",
"url": "http://code.google.com/p/bitly-api/"
}
]
},
"status_code": 200,
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/lookup?url=http%3A%2F%2Fbetaworks.com%2F&ur
l=http%3A%2F%2Fcode.google.com%2Fp%2Fbitly-api%2F&login=bitlyapi
demo&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&format=xml
200
http://betaworks.com/
http://bit.ly/beta
beta
http://code.google.com/p/bitly-api/
http://bit.ly/1oDCU
1oDCU
OK
json
http://api.bit.ly/v3/lookup?url=asdf%3A%2F%2Fwww.google.com%2Fno
-
18
t%2Fa%2Freal%2Flink&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35
f52f629d2d71bf07&format=json
{
"data": {
"lookup": [
{
"error": "NOT_FOUND",
"url": "asdf://www.google.com/not/a/real/link"
}
]
},
"status_code": 200,
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/lookup?url=asdf%3A%2F%2Fwww.google.com%2Fno
t%2Fa%2Freal%2Flink&login=bitlyapidemo&apiKey=R_0da49e0a9118ff35
f52f629d2d71bf07&format=xml
200
asdf://www.google.com/not/a/real/link
NOT_FOUND
OK
-
19
/v3/authenticate
bit.lybit.ly API key
[email protected]
ID apiKey
x_login bit.ly
x_password bit.ly
format
json xml
HTTP POST HTTP GET
successful
username bit.ly
api_key bit.ly apiKey
json http://api.bit.ly/v3/authenticate
POST:
x_login=bitlyapidemo&x_password=bad-password&apiKey=R_0da49e0a9118ff35
f52f629d2d71bf07&login=bitlyapidemo&format=json
{
"data": {
"authenticate": {
"successful": false
}
},
"status_code": 200,
-
20
"status_txt": "OK"
}
xml http://api.bit.ly/v3/authenticate
POST:
x_login=bitlyapidemo&x_password=bad-password&apiKey=R_0da49e0a9118ff35
f52f629d2d71bf07&login=bitlyapidemo&format=xml
200
0
OK
json http://api.bit.ly/v3/authenticate
POST:
x_login=bitlyapidemo&x_password=good-password&apiKey=R_0da49e0a9118ff3
5f52f629d2d71bf07&login=bitlyapidemo&format=json
{
"data": {
"authenticate": {
"api_key": "R_0da49e0a9118ff35f52f629d2d71bf07",
"successful": true,
"username": "bitlyapidemo"
}
},
"status_code": 200,
"status_txt": "OK"
}
xml http://api.bit.ly/v3/authenticate
-
21
POST:
x_login=bitlyapidemo&x_password=good-password&apiKey=R_0da49e0a9118ff3
5f52f629d2d71bf07&login=bitlyapidemo&format=xml
200
bitlyapidemo
1
R_0da49e0a9118ff35f52f629d2d71bf07
OK
/v3/info
bit.ly
format
json xml txt
shortUrl bit.ly URL http://bit.ly/1RmnUT
http://j.mp/1RmnUT
hash bit.ly hash 2bYgqR
shortUrl hash
shortURL hash
short_url shortUrl
-
22
hash hash
user_hash bit.ly ID
global_hash URL bit.ly hash ID
error shortUrl hash
NOT_FOUND
title HTML page title
created_by link bit.ly
json
http://api.bit.ly/v3/info?shortUrl=http%3A%2F%2Ftcrn.ch%2Fa4MSUH
&shortUrl=http%3A%2F%2Fbit.ly%2F1YKMfY&login=bitlyapidemo&apiKey
=R_0da49e0a9118ff35f52f629d2d71bf07&hash=j3&hash=a.35&format=jso
n
{
"data": {
"info": [
{
"created_by": "scotster",
"global_hash": "lLWr",
"hash": "j3",
"title": null,
"user_hash": "j3"
},
{
"error": "NOT_FOUND",
"hash": "a.35"
},
{
"created_by": "j3h14h",
"global_hash": "bWw49z",
"short_url": "http://tcrn.ch/a4MSUH",
"title": "Windows Mobile Finally Checks Out
Foursquare",
-
23
"user_hash": "a4MSUH"
},
{
"created_by": "bitly",
"global_hash": "1YKMfY",
"short_url": "http://bit.ly/1YKMfY",
"title": null,
"user_hash": "1YKMfY"
}
]
},
"status_code": 200,
"status_txt": "OK"
}
xml
http://api.bit.ly/v3/info?shortUrl=http%3A%2F%2Ftcrn.ch%2Fa4MSUH
&shortUrl=http%3A%2F%2Fbit.ly%2F1YKMfY&login=bitlyapidemo&apiKey
=R_0da49e0a9118ff35f52f629d2d71bf07&hash=j3&hash=a.35&format=xml
200
lLWr
j3
j3
scotster
a.35
NOT_FOUND
-
24
http://tcrn.ch/a4MSUH
bWw49z
a4MSUH
j3h14h
Windows Mobile Finally Checks Out
Foursquare
http://bit.ly/1YKMfY
1YKMfY
1YKMfY
bitly
OK