.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Net::Dropbox::API 3" .TH Net::Dropbox::API 3 2024-09-01 "perl v5.40.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Net::Dropbox::API \- A dropbox API interface .SH VERSION .IX Header "VERSION" Version 1.9.8 .SH SYNOPSIS .IX Header "SYNOPSIS" The Dropbox API is a OAuth based API. I try to abstract as much away as possible so you should not need to know too much about it. This is how it works: .PP .Vb 1 \& use Net::Dropbox::API; \& \& my $box = Net::Dropbox::API\->new({key => \*(AqKEY\*(Aq, secret => \*(AqSECRET\*(Aq}); \& my $login_link = $box\->login; # user needs to click this link and login \& $box\->auth; # oauth keys get exchanged \& my $info = $box\->account_info; # and here we have our account info .Ve .PP See the examples for a working Mojolicious web client using the Dropbox API. .PP You can find Dropbox's API documentation at .SH FUNCTIONS .IX Header "FUNCTIONS" .SS login .IX Subsection "login" This sets up the initial OAuth handshake and returns the login URL. This URL has to be clicked by the user and the user then has to accept the application in dropbox. .PP Dropbox then redirects back to the callback URL defined with \&\f(CW\*(C`$self\->callback_url\*(C'\fR. If the user already accepted the application the redirect may happen without the user actually clicking anywhere. .SS auth .IX Subsection "auth" The auth method changes the initial request token into access token that we need for subsequent access to the API. This method only has to be called once after login. .SS account_info .IX Subsection "account_info" account_info polls the users info from dropbox. .SS list .IX Subsection "list" lists all files in the path defined: .PP .Vb 2 \& $data = $box\->list(); # top\-level \& $data = $box\->list( "/Photos" ); # folder .Ve .PP The data returned is a ref to a hash containing various fields returned by Dropbox, including a \f(CW\*(C`hash\*(C'\fR value, which can be used later to check if Dropbox data beneath a specified folder has changed since the last call. .PP For this, \f(CWlist()\fR accepts an optional 'hash' argument: .PP .Vb 2 \& $data = $box\->list({ hash => "ce9ccbfb8f255f234c93adcfef33b5a6" }, \& "/Photos"); .Ve .PP This will either return .PP .Vb 1 \& { http_response_code => 304 } .Ve .PP in which case nothing has changed since the last call, or .PP .Vb 3 \& { http_response_code => 200, \& # ... various other fields \& } .Ve .PP if there were modifications. .SS copy .IX Subsection "copy" copies a folder copy($from, \f(CW$to\fR) .SS move .IX Subsection "move" move a folder move($from, \f(CW$to\fR) .SS mkdir .IX Subsection "mkdir" creates a folder mkdir($path) .SS delete .IX Subsection "delete" delete a folder delete($path) .SS view .IX Subsection "view" creates a cookie protected link for the user to look at. view($path) .SS metadata .IX Subsection "metadata" creates a cookie protected link for the user to look at. metadata($path) .SS putfile .IX Subsection "putfile" uploads a file to dropbox .SS getfile .IX Subsection "getfile" get a file from dropbox .SS debug .IX Subsection "debug" Set this to a non-false value in order to print some debugging information to STDOUT. \fBdebug\fR\|(1) .SH "INTERNAL API" .IX Header "INTERNAL API" .SS _talk .IX Subsection "_talk" _talk handles the access to the restricted resources. You should normally not need to access this directly. .SS nonce .IX Subsection "nonce" Generate a different nonce for every request. .SH AUTHOR .IX Header "AUTHOR" Lenz Gschwendtner, \f(CW\*(C`\*(C'\fR .PP With Bug fixes from: .PP Greg Knauss \f(CW\*(C`gknauss at eod.com\*(C'\fR .PP Chris Prather \f(CW\*(C`chris at prather.org\*(C'\fR .PP Shinichiro Aska .PP [ktdreyer] .PP SureVoIP .SH BUGS .IX Header "BUGS" Please report any bugs through the web interface at . I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. .SH SUPPORT .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Net::Dropbox::API .Ve .PP You can also look for information at: .IP \(bu 4 AnnoCPAN: Annotated CPAN documentation .Sp .IP \(bu 4 CPAN Ratings .Sp .IP \(bu 4 Search CPAN .Sp .SH "COPYRIGHT & LICENSE" .IX Header "COPYRIGHT & LICENSE" Copyright 2010 Lenz Gschwendtner. .PP This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. .PP See http://dev.perl.org/licenses/ for more information.