cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Using Dropbox API with C# MVC

Using Dropbox API with C# MVC

Gabriel A.1
New member | Level 1

I have a simple page that has a textbox and a button. The idea is that the user will enter a shared link that has multiple files into the textbox,a Save As dialog box will popup and the user will download file to the location they choose.

My question is how do I setup my environment for this to work in MVC. I am new to Dropbox and all I have is the API installed and I also have the APP key and APP secret.

6 Replies 6

Rich
Super User II

Moved to the API forum.

Greg-DB
Dropbox Staff

Hi Gabriel, it sounds like your question is more about setting up your app and environment itself, and not yet about using the Dropbox API. That being the case, I'm afraid I can't offer much help. How you set up your environment and app, e.g., what pattern, like MVC, you use, are up to you.

Once you do have your app running though and are ready to make some API calls, it sounds like these endpoints may be helpful:

https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_metadata

https://www.dropbox.com/developers/documentation/http/documentation#sharing-get_shared_link_file

https://www.dropbox.com/developers/documentation/http/documentation#files-download

Gabriel A.1
New member | Level 1

Gregory,

I have MVC setup already. My question is for example how do you get a file from a link.

Below does not help me in C#. In other words, how do I set up a simple example with the API to get the /get_shared_link_file in .NET?

curl -X POST https://content.dropboxapi.com/2/sharing/get_shared_link_file \
    --header "Authorization: Bearer <REDACTED>" \
    --header "Dropbox-API-Arg: {\"url\": \"https://www.dropbox.com/s/2sn712vy1ovegw8/Prime_Numbers.txt?dl=0\",\"path\": \"/Prime_Numbers.txt\"}"

Greg-DB
Dropbox Staff

If you can, we recommend using the .NET SDK for C# projects:

https://www.dropbox.com/developers/documentation/dotnet

In that SDK, the respective methods are:

https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Sharing_Routes_SharingRoutes_GetShar...

https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Sharing_Routes_SharingRoutes_GetShar...

https://dropbox.github.io/dropbox-sdk-dotnet/html/M_Dropbox_Api_Files_Routes_FilesRoutes_DownloadAsy...

Otherwise, you'll need to make the HTTP calls using whatever HTTP client you'd like.

By the way, I redacted your access token, but for the sake of security, you should disable that access token. You can do so by revoking access to the app entirely, if the access token is for your account, here:

https://www.dropbox.com/account/security

Or, you can disable just this access token using the /disable_access_token endpoint:

https://www.dropbox.com/developers/core/docs#disable-token

Gabriel A.1
New member | Level 1

Gregory,

Thanks for taking your time and replying back to me. 

Quick question:

My requirement is the following. I have a user that enters a public shared Dropbox link into a textbox and then it uploads to the server.

Would I need the Token and so forth since the link is public? Would I even need the Dropbox API?

Thanks again.

Greg-DB
Dropbox Staff

There is some basic functionality, i.e., downloading the file or folder, possible using just the shared link. Refer to this help article for more information:

https://www.dropbox.com/help/201

For anything more advanced than that, you will need to use the API calls, which do require an access token.

Need more support?