블로그 이미지
Sunny's

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

'durl.kr'에 해당되는 글 1

  1. 2010.09.03 다음 Open API (durl.kr 긴주소 짧게 )1
2010. 9. 3. 09:58 ETC

http://durl.kr/

Open API

Durl provides REST OpenAPI to allow (web)application developers to use Durl's service.

You can easily reduce longurl to shorturl and get the snapshot image of website longurl denotes.

Creation

api

http://durl.me/api/Create.do

param
  • longurl: Long url you want to reduce
  • type(optional): "xml" or "json", default value is "xml"
  • callback(optional): Until you specify a type as "json", this param has no meaning. It denotes a callback function name user defined.

return value

xml
  • structure
    • status: "ok" or "invalid"
    • long-url: original url
    • short-url: reduced url
    • key: identifier
  • structure example
 
json
  • structure
    • status: "ok" or "invalid"
    • longUrl: original url
    • shortUrl: reduced url
    • key: identifier
  • structure example

    • if you specify a callback function name as "jsFunc"

 

Status Checking

 
api

http://durl.me/KEY.status

param
  • type(optional): "xml" or "json", default value is "xml"
  • callback(optional): Until you specify a type as "json", it has no meaning. This param denotes callback function name user defined.

return value

xml
  • structure
    • key: identifier
    • image-ready: "yes" or "no"
    • image-url-small: small(400x300) png image url
    • image-url-big: big(1024x768) png image url
  • structure example

json
  • structure
    • key: identifier
    • imageReady: "yes" or "no"
    • imageUrlSmall: small(400x300) png image url
    • imageUrlBig: big(1024x768) png image url
  • structure example

    • if you specify a callback function name as "jsFunc"

 

Snapshot Image

api

http://durl.me/KEY.image

return value

png image data

Open API Example

1. if you want to reduce a long url like

http://www.google.co.kr/search?complete=1&hl=ko&q=why+worry&lr=&aq=5&oq=why

just call Create.do

http://durl.me/api/Create.do?longurl=http%3A//www.google.co.kr/search%3Fcomplete%3D1%26hl%3Dko%26q%3Dwhy%2Bworry%26lr%3D%26aq%3D5%26oq%3Dwhy

and then you can get xml data like below.


if you specify type=json like

http://durl.me/api/Create.do?type=json&longurl=http%3A//www.google.co.kr/search%3Fcomplete%3D1%26hl%3Dko%26q%3Dwhy%2Bworry%26lr%3D%26aq%3D5%26oq%3Dwhy

you can get json data like below



 

if you want to use a callback function helloCallback directly in your javascript code,

just add callback=helloCallback

http://durl.me/api/Create.do?type=json&callback=helloCallback&longurl=http%3A//www.google.co.kr/search%3Fcomplete%3D1%26hl%3Dko%26q%3Dwhy%2Bworry%26lr%3D%26aq%3D5%26oq%3Dwhy

then you can get json data like below



 

2. You got a key "bt2" and short url

http://durl.me/bt2


Then you want to get bt2's snapshot image

just add .image

http://durl.me/bt2.image

3. Website snapshot takes a time for a while. so if you want to know that it has finished capturing a snapshot of
website,

just add .status

http://durl.me/bt2.status

then you can get xml data like below



if you want json data,

specify type=json

http://durl.me/bt2.status?type=json

then you can get json data like below


if you want to add callback function,

specify callback=callbackNameYouwant

http://durl.me/bt2.status?type=json&callback=callbackNameYouwant

then you can get json data like below


That's all.

Isn't it easy?


posted by Sunny's
prev 1 next