GithubHelp home page GithubHelp logo

dropbox's Introduction

This is a Dropbox ReST API client for Zend Framework v1.10+ (current proposal for Zend_Service_Dropbox is not maintained).

##REQUIREMENTS##

  • Zend Framework v1.10+
  • PHP 5.2.10+

##USAGE## Dropbox ReST API is using OAuth v1, so I use Zend_Oauth_* for all API request (inspired by Zend_Service_Twitter)

###Initial###

<?php
$options = array(
    // https://api.dropbox.com/developers/apps
    'consumerKey'    => 'CONSUMER_KEY',
    'consumerSecret' => 'CONSUMER_SECRET',
    'callbackUrl'    => 'http://127.0.0.1/dropbox/callback',
);
$dropbox = new ZendX_Service_Dropbox($options);

###Login/Authorize###

<?php
$requestToken = $dropbox->getRequestToken();
$dropbox->redirect();

###Callback/Get Access Token### $accessToken need to be inserted to $options['accessToken'] for further API request.

<?php 
// via Controller
$query = $this->getRequest()->getQuery();
$accessToken = $dropbox->getAccessToken($query, $requestToken);

// Save $accessToken to Session or Zend_Config for further request
// Or you can set $accessToken->getToken() and $accessToken->getTokenSecret() 
// to Zend_Oauth_Consumer constructor options

###API Call###

<?php
// https://www.dropbox.com/developers/reference/api#account-info
$dropbox->accountInfo(); // return json

// https://www.dropbox.com/developers/reference/api#files-GET
$dropbox->fileGet($path, $rev);

// https://www.dropbox.com/developers/reference/api#files_put
$dropbox->filePut($file, $path, $overwrite);

// https://www.dropbox.com/developers/reference/api#metadata
$dropbox->fileMetadata($path, $limit, $hash, $list, $include_deleted, $rev);

// https://www.dropbox.com/developers/reference/api#revisions
$dropbox->fileRevision($path, $rev_limit);

// https://www.dropbox.com/developers/reference/api#restore
$dropbox->fileRestore($path, $rev);

// https://www.dropbox.com/developers/reference/api#search
$dropbox->fileSearch($path, $query, $file_limit, $include_deleted);

// https://www.dropbox.com/developers/reference/api#shares
$dropbox->fileShares($path);

// https://www.dropbox.com/developers/reference/api#media
$dropbox->fileMedia($path);

// https://www.dropbox.com/developers/reference/api#thumbnails
$dropbox->fileThumbnails($path, $format, $size);

// https://www.dropbox.com/developers/reference/api#fileops-copy
$dropbox->fileOpsCopy($from_path, $to_path);

// https://www.dropbox.com/developers/reference/api#fileops-create-folder
$dropbox->fileOpsCreateFolder($path);

// https://www.dropbox.com/developers/reference/api#fileops-delete
$dropbox->fileOpsDelete($path);

// https://www.dropbox.com/developers/reference/api#fileops-move
$dropbox->fileOpsMove($from_path, $to_path);

All api call will return json string, except fileGet() and fileThumbnails() will return original http response from dropbox.

##LICENSE## All files are licensed under the MIT License.

dropbox's People

Contributors

simukti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

dropbox's Issues

spaces and "umlauts" in a path returns a FatalError

if i use

$dropbox->fileMetadata('/mypath/mypath with äö/');

it returns

"Fatal error: Uncaught exception 'Zend_Uri_Exception' with message 'Invalid URI supplied' in W:\zendserver\Apache2\htdocs\classes\Zend\Uri\Http.php:156"

i testet urlencode and rawurlencode the path....the same error...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.