How to upload to Dropbox public folder and get public URL?

I have a situation where I need to upload a file to my Dropbox shared folder, and also after downloading, do I need to save the open URL of the downloaded file? I am using python and any help on this would be great.

Thanks.

+4
source share
1 answer

Use this to customize the Python SDK in your program.

https://www.dropbox.com/developers/start/setup#python

This will give you all the file information:

folder_metadata = client.metadata('/') 

I believe that you are talking about these short links, so you know, every small link from a shared folder is generated only by special request and has a validity period.

If you want the permalink to go to step 2.

STEP 1

This information was taken from: https://www.dropbox.com/developers/reference/api

 /shares 

DESCRIPTION

Creates and returns a shared link to files or folders.

Note. Links created by calling the API / share API expire after thirty days.

URL STRUCTURE

https://api.dropbox.com/1/shares/<root>/<path>

root The root relative to the specified path. Valid values ​​are sandbox and dropbox.

path The path to the file or folder to which you want to use the shared link.

EXECUTIONS

0, 1

METHOD

Post

PARAMETERS

locale Used to specify the language settings for user error messages and another language

specific text. See Notes above for more information on supported locales.

RETURN

Shared link to a file or folder. The link can be used publicly and sent to the file’s preview page. Also returns the expiration date of the link in the usual Dropbox date format.

An example JSON return value for a file

 { "url": "http://db.tt/APqhX1", "expires": "Wed, 17 Aug 2011 02:34:33 +0000" } 

If you have done step 1, do not do step 2.

STEP 2

 /files (GET) 

DESCRIPTION

File downloads. Note that this call goes to the api-content server.

URL STRUCTURE

 https://api-content.dropbox.com/1/files/<root>/<path> 

root The root relative to the specified path. Valid values ​​are sandbox and dropbox. path The path to the file you want to receive.

EXECUTIONS

0, 1

METHOD

Get

PARAMETER

rev Review the file to extract. This default value applies to the most recent version.

RETURN

The specified file contents in the requested version.

The HTTP response contains JSON-formatted content metadata in the x-dropbox-metadata header.

ERRORS

404 The file was not found on the specified path or not found on the specified rev.

NOTES

This method also supports HTTP Retrieval Request requests to allow retrieving the contents of a partial file. `

DONE

+4
source

Source: https://habr.com/ru/post/1402617/


All Articles