jopbox is a Clojure library for working with the Dropbox API.
You can visit http://jopbox-demo.herokuapp.com/ for a demo web-app
that uses jopbox. The source of the demo can be found
here.
Add this to your project.clj's dependencies:
:dependencies [jopbox "0.2.0"]
Require jopbox from the REPL:
(use 'jopbox.client)
And before doing anything, you'll want to create a new Dropbox app here.
(def consumer (make-consumer API-KEY API-SECRET))
(def request-token (fetch-request-token consumer <callback-uri>))
Now, get the authorization URL:
(authorization-url consumer request-token)
;=> Visit the URL that this returns on your browser.
Then, get the access token response
(def access-token-response (fetch-access-token-response consumer request-token))
If you're using this with a web app, you probably want to use a callback URI to fetch the token response.
See Dropbox's API Reference for more information on these methods.
/account/info(account-info consumer access-token-response)
/metadata(metadata consumer access-token-response :sandbox "video.flv")
/delta(delta consumer access-token-response <cursor>)
/media(media consumer access-token-response :sandbox "video.flv")
/files(GET)(get-file consumer access-token-response :sandbox "foo.txt")
;; This works fine with plaintext files, but if you're dealing with something else you probably want to use /media.
/files_put(upload-file consumer access-token-response :sandbox "foo.mp3" "/path/to/foo.mp3")
Create a file test/jopbox/dropbox_keys.clj with the following
content:
(def dropbox-key "YOUR-API-KEY")
(def dropbox-secret "YOUR-API-SECRET")
Then, run lein test.
Copyright © 2013 Samrat Man Singh
Distributed under the Eclipse Public License, the same as Clojure.
Can you improve this documentation?Edit on GitHub
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |