You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Gert-Jan K.
10 years agoNew member | Level 1
Using API from Excel VBA
Hello,
I'm trying to figure out how the API exactly works to download files from Dropbox from Excel VBA (2010, 2013).
The main issue for now is how to get past the authorization part.
I'v setup the app in de dev-corner.
Status: Development
Allow implicit grant: Disallow
My https-request to Dropbox is:
"https://www.dropbox.com/1/oauth2/authorize?response_type=code&client_id=[app-key]&redirect_uri=http://localhost" (which I open using "WinHttpReq.Open "GET", myURL, False" (where myURL is the URL to Dropbox).
The return-value consists mainly of question-marks. That also happens if I don't specify a redirect_uri. (Btw, I'm matching up the redirect_uri in the dev-panel and the code).
I expected/hoped to receive the response with the access token, but apparently I'm doing something wrong.
Can anyone help me out?
Thanks,
Gejakem
- Greg-DBDropbox Staff
That endpoint is only supported for apps with the full Dropbox permission, so you'll get this error if you call using an app with a different permission, per the documentation:
> This API endpoint requires Full Dropbox permission.
If you want to use that endpoint you can register an app for the full Dropbox permission.
- Greg-DBDropbox Staff
The /oauth2/authorize URL is not an API endpoint, but rather a page on the Dropbox web site, where the user can choose whether or not to authorize your app to their Dropbox account. You should be directing the user to it in a browser, and not programmatically requesting it.
The following pages have more information about implementing the OAuth 2 app authorization flow:
https://www.dropbox.com/developers/reference/oauth-guide
https://blogs.dropbox.com/developers/2013/07/using-oauth-2-0-with-the-core-api/ - Gert-Jan K.New member | Level 1
Update.
When I read the results using "ResponseText" in stead of "ResponseBody" I do get a readable response.Looks like (first part):
<!DOCTYPE html>
<html lang="en" xmlns:fb="http://ogp.me/ns/fb#" xml:lang="en" class=" xmlns="http://www.w3.org/1999/xhtml">
<head>
<script nonce="bkK440PlJxi6kqbQgYbz">
window._goch_ = {};
window.addEventListener('click', function(event)
{
'use str - Gert-Jan K.New member | Level 1
My request is not about an app requesting access to the user's Dropbox-account, but rather the other way around.
Users that will be using my Excel-file will need access to a folder in MY Dropbox-account.From there they will be granted access to a specific folder and the Excel-file will read file-listings and file-contents from Dropbox.
It's a bit like sharing a Dropbox-folder with someone.
I already used the provided link (from sharing a folder), but that returns a complete HTML-page with a lot of clutter I don't need.
I only need a file-listing first and then in a second step I will need to download one of those files. - Greg-DBDropbox Staff
In that case, if your app will only be connecting to your own account, you don't need to implement the OAuth app authorization flow at all.
For reference, the API was designed with the intention that each user would link their own Dropbox account, in order to interact with their own files. However, it is technically possible to connect to just one account. The SDKs don't offer explicit support for it and we don't recommend doing so, for various technical and security reasons.
However if you did want to go this route, instead of kicking off the authorization flow, you would manually use an existing access token for your account and app. (Just be careful not to revoke it, e.g. via https://www.dropbox.com/account/security .) For example, you can generate an access token for your account via your app's page on the App Console.
If you have a shared link that you want to get information about programmatically you can use /metadata/link.
- Gert-Jan K.New member | Level 1
Gregory,
Thanx for your quick and helpful answers.
This route (metadata/link) seems like a good one (reading through the docs).
When POSTing this:https://api.dropbox.com/1/metadata/link?link=https://www.dropbox.com/sh/[scramble1]/[scramble2]?dl=0&client_id=[app-key]&client_secret=[app-secret]
the return value is
{"error": "access_denied:unsupported_app_type"}
The error-code is 403 and the status-text is "Forbidden".
What does this mean? I'm not able to find the meaning of this on Internet or the Droppbox-docs.
- Gert-Jan K.New member | Level 1
Yes, that did the trick!
Thanx, Greg, you're the best :-) - Rammiz O.Explorer | Level 4
@gejakem can you please share your code?
I want to create a VBA app which generates a list of all the files in my Dropbox Account in Excel so I can compare using Excel to files i have on various hard drives to then start deleting the physical copies already backed up to Dropbox.
Help? :-)
- Gert-Jan K.New member | Level 1
Hey Rammiz,
I moved away from using Dropbox for my purpose.
Now, from excel, I'm making a call to a PHP-webserver that returns the values to the Excel-file I need (provided by a MySQL database).So, there's no final/usable code I can provide you with. Sorry.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,883 PostsLatest Activity: 2 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!