Contenu connexe
Similaire à bit.ly APIについての
Similaire à bit.ly APIについての (20)
Plus de Orinoco K.K. (14)
bit.ly APIについての
- 2. • ⾏行行
•
•
⽤用
⽂文
•
⽤用
⼀一 ⽤用
•
⽣生 ⽰示 ⽰示
⾼高
⽰示
• 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
2
- 4. •
⼒力力
•
⽤用
•
⽤用
⽤用
•
• ⽩白 ⽤用 ⽩白
⽩白 ⾏行行
⽩白 ⽩白 ⾏行行
•
•
⼒力力
•
•
⽤用
•
•
⽰示 ⽤用
•
4
- 5. •
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"
}
•
http://api.bit.ly/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0
a9118ff35f52f629d2d71bf07&longUrl=http%3A%2F%2Fbetaworks.com%2F&
format=xml
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<status_txt>OK</status_txt>
<data>
<url>http://bit.ly/cmeH01</url>
<hash>cmeH01</hash>
<global_hash>1YKMfY</global_hash>
<long_url>http://betaworks.com/</long_url>
<new_hash>0</new_hash>
</data>
</response>
•
http://api.bit.ly/v3/shorten?login=bitlyapidemo&apiKey=R_0da49e0
5
- 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"
}
]
},
7
- 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<status_txt>OK</status_txt>
<data>
<entry>
<short_url>http://tcrn.ch/a4MSUH</short_url>
<long_url>http://www.techcrunch.com/2010/01/29/window
s-mobile-foursquare/</long_url>
<user_hash>a4MSUH</user_hash>
<global_hash>bWw49z</global_hash>
</entry>
<entry>
<short_url>http://bit.ly/1YKMfY</short_url>
<long_url>http://betaworks.com/</long_url>
<user_hash>1YKMfY</user_hash>
<global_hash>1YKMfY</global_hash>
</entry>
<entry>
<hash>j3</hash>
<long_url>http://www.scotster.com/qf/?1152</long_url>
<user_hash>j3</user_hash>
<global_hash>lLWr</global_hash>
</entry>
<entry>
<error>NOT_FOUND</error>
8
- 9. <hash>a35.</hash>
</entry>
</data>
</response>
• 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<status_txt>OK</status_txt>
<data>
<entry>
<short_url>http://bit.ly/31IqMl</short_url>
9
- 10. <long_url>http://cnn.com/</long_url>
<user_hash>31IqMl</user_hash>
<global_hash>31IqMl</global_hash>
</entry>
</data>
</response>
• 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/
•
•
⽤用
•
⽤用
⼒力力
•
⽰示
• 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": {
10
- 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<status_txt>OK</status_txt>
<data>
<valid>0</valid>
</data>
</response>
• txt
http://api.bit.ly/v3/validate?x_login=notbilytapi&x_apiKey=not_a
pikey&apiKey=R_0da49e0a9118ff35f52f629d2d71bf07&login=bitlyapide
mo&format=txt
0
⼀一
•
•
⼀一
11
- 12. •
⼀一
•
• ⾼高
⼒力力
•
•
•
•
•
•
•
⽣生
• 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
},
{
12
- 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<data>
<clicks>
<short_url>http://tcrn.ch/a4MSUH</short_url>
<global_hash>bWw49z</global_hash>
13
- 14. <user_clicks>0</user_clicks>
<user_hash>a4MSUH</user_hash>
<global_clicks>1105</global_clicks>
</clicks>
<clicks>
<short_url>http://bit.ly/1YKMfY</short_url>
<global_hash>1YKMfY</global_hash>
<user_clicks>2218</user_clicks>
<user_hash>1YKMfY</user_hash>
<global_clicks>2218</global_clicks>
</clicks>
<clicks>
<user_clicks>105</user_clicks>
<global_hash>lLWr</global_hash>
<hash>j3</hash>
<user_hash>j3</user_hash>
<global_clicks>106</global_clicks>
</clicks>
<clicks>
<hash>a35.</hash>
<error>NOT_FOUND</error>
</clicks>
</data>
<status_txt>OK</status_txt>
</response>
14
- 15. ⽤用
⽤用 ⽤用
⽂文
•
•
⼒力力
•
⽰示
•
• 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<data>
<domain>nyti.ms</domain>
<bitly_pro_domain>1</bitly_pro_domain>
</data>
15
- 16. <status_txt>OK</status_txt>
</response>
⽤用
⽤用
•
⼀一
•
•
⼒力力
•
•
• 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/"
},
{
16
- 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<data>
<lookup>
<url>http://betaworks.com/</url>
<short_url>http://bit.ly/beta</short_url>
<global_hash>beta</global_hash>
</lookup>
<lookup>
<url>http://code.google.com/p/bitly-api/</url>
<short_url>http://bit.ly/1oDCU</short_url>
<global_hash>1oDCU</global_hash>
</lookup>
</data>
<status_txt>OK</status_txt>
</response>
• json
http://api.bit.ly/v3/lookup?url=asdf%3A%2F%2Fwww.google.com%2Fno
17
- 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<data>
<lookup>
<url>asdf://www.google.com/not/a/real/link</url>
<error>NOT_FOUND</error>
</lookup>
</data>
<status_txt>OK</status_txt>
</response>
18
- 19.
⽤用
⽤用⽅方 ⼀一
•
•
•
•
⼒力力
•
⽰示
•
•
• 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,
19
- 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<data>
<authenticate>
<successful>0</successful>
</authenticate>
</data>
<status_txt>OK</status_txt>
</response>
• 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
20
- 22. •
•
•
•
⽣生
•
•
• 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",
22
- 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
<?xml version="1.0" encoding="UTF-8"?>
<response>
<status_code>200</status_code>
<data>
<info>
<global_hash>lLWr</global_hash>
<hash>j3</hash>
<user_hash>j3</user_hash>
<created_by>scotster</created_by>
<title/>
</info>
<info>
<hash>a.35</hash>
<error>NOT_FOUND</error>
</info>
23
- 24. <info>
<short_url>http://tcrn.ch/a4MSUH</short_url>
<global_hash>bWw49z</global_hash>
<user_hash>a4MSUH</user_hash>
<created_by>j3h14h</created_by>
<title>Windows Mobile Finally Checks Out
Foursquare</title>
</info>
<info>
<short_url>http://bit.ly/1YKMfY</short_url>
<global_hash>1YKMfY</global_hash>
<user_hash>1YKMfY</user_hash>
<created_by>bitly</created_by>
<title/>
</info>
</data>
<status_txt>OK</status_txt>
</response>
24