Dropbox Datastore API Demo
Dropbox 에서 제공하는 Datastore API (Javascript) 를 이용하여 파일에 데이터를 저장하는 예
참고
https://www.dropbox.com/developers
Datastore API
https://www.dropbox.com/developers/datastore
Using the Datastore API in JavaScript
https://www.dropbox.com/developers/datastore/tutorial/js
Datastore API SDKs
https://www.dropbox.com/developers/datastore/sdks/js
https://github.com/dropbox/dropbox-js
Dropbox 사이트에서 app 을 생성한다
https://www.dropbox.com/developers/apps
App을 생성하면 App Key, App Secret 이 주어진다
Writing a file with the Dropbox JavaScript SDK
https://www.dropbox.com/developers/blog/71/writing-a-file-with-the-dropbox-javascript-sdk
Drop-In (Chooser, Saver) Tutorial
http://code.tutsplus.com/tutorials/dropbox-datastores-and-drop-ins--net-34509
블로그 측의 코드
블로그에서 Dropbox 에 데이터를 전달하는 내용
<script type="text/javascript"> function sendData() { location.href='https://dl.dropboxusercontent.com/u/92046264/datastore_test.html?param1=Data_From_MyBlog'; } </script> <input type="button" value="Dropbox에 데이터 저장" onclick="sendData();">
Dropbox 측의 html 파일 ( 블로그에서 전달한 데이터를 수신하여 파일에 저장하는 기능 )
Dropbox 의 Public 디렉토리 안에 저장된 html 파일 ( datastore_test.html )
<script src="https://www.dropbox.com/static/api/dropbox-datastores-1.1-latest.js" type="text/javascript"></script> <script type="text/javascript"> function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split('&'); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split('='); if (decodeURIComponent(pair[0]) == variable) { return decodeURIComponent(pair[1]); } } console.log('Query variable %s not found', variable); } var client = new Dropbox.Client({ key: 'tseyowytiesco4f' }); client.authenticate(function () { var param1_value = getQueryVariable('param1'); client.writeFile('app/hello한글.txt', param1_value, function () { alert('File written!'); }); });
Dropbox에서 제공하는 Datastore API (Javascript)를 사용하여 테이블을 생성하고 데이터스토어에 레코드를 추가하는 예