Skip to content

Working with Shared Links Folders

Kunal Varma edited this page Sep 27, 2017 · 2 revisions

Working with Shared Links and Folders

Currently the SDK doesn't have dedicated methods for interacting with the Sharing endpoints, similar to how you have dedicated methods to get metadata of files/folders or upload a file.

However, the SDK can still make requests to the sharing endpoints (or any Dropbox API endpoint) and fetch/decode data.

For example, you can create a Shared Link like this:

/**
* Assuming you have configured the DropboxApp class
* @see https://github.com/kunalvarma05/dropbox-php-sdk/wiki/Configuration
*/
$dropbox = new Dropbox($app);
$pathToFile = "/hello-world.txt";

$response = $dropbox->postToAPI("/sharing/create_shared_link_with_settings", [
    "path" => $pathToFile
]);

$data = $response->getDecodedBody();

var_dump($data);