Open API Guide

Open API 개발 가이드

운영 중인 웹서비스에 연동하여 긴 주소를 단축주소로 쉽게 변환할 수 있도록 Open API를 제공합니다.
Open API는 dooo.us 에 가입한 회원 누구나 이용할 수 있습니다.
운영중인 웹서비스에서 dooo 단축주소 서비스를 연동하여 보다 풍요로운 서비스를 제공해 보세요.

토큰키 발급

dooo API 사용을 위해선 회원 계정에서 발급된 토큰키가 필요합니다. 아래 링크로 접속하여개인 토큰을 발급합니다.
console API 토큰 관리

Request

Rest URL
단축 주소 및 QR코드 생성을 위한 요청 URL은 아래와 같습니다.
메서드 요청 URL 출력 포맷
POST https://dooo.us/api/get-dooo JSON
Request Header
Rest URL에 Request 하는 경우 아래 Header를 실어 요청합니다.
헤더명 설명
X-DOOO-CLIENT-TOKEN Console에서 발급 받은 토큰 키
X-DOOO-CLIENT-TOKEN:{TOKEN KEY}
Request Body
Rest URL에 Request 하는 경우 아래와 같은 Parameter를 POST로 전송합니다.
변수명 타입 필수 여부 기본 값 설명
url string Y - 단축 하고자 하는 URL를 입력합니다.

Response

Response Body (JSON)
URL 단축이 성공적으로 완료된 경우 아래와 같이 응답합니다.
필드 타입 설명
code int 성공 여부를 반환합니다.
- 성공 : 0000
- 실패 : 9999
msg string 성공/실패 여부 메시지 반환
result hash string 단축된 hash 반환
url string 단축된 URL 반환

Console 에서 보유 도메인이 연동된 경우 연동된 도메인으로 단축 URL 생성 및 반환
ex) http://foo.com/Df3Wg
orgUrl string 원본 URL 반환
qrUrl string 생성된 QR Code 다운로드 URL 반환

Example

Request
PHP
<?php $data = array( 'url' => 'http://domainname.dooo.us/longurl.html?target=myself' ); $header = array( 'X-DOOO-CLIENT-TOKEN: {TOKEN KEY}' ); $url = "https://dooo.us/api/get-dooo"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, $header); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); $response = curl_exec($ch); curl_close($ch);
Response
JSON
{ "code" : "0000", "msg" : "ok", "result" : { "hash" : "Dw4vD13", "url" : "https://dooo.us/Dw4vD13", "orgUrl" : "http://domainname.dooo.us/longurl.html?target=myself", "qrUrl" : "https://website-attach.cdn-server.dooo.us/dooo-attach/qrfile/f6w623jflDF2723fjfjke1234i.png" } }