Forum Discussion

masplin's avatar
masplin
Explorer | Level 4
9 years ago

converting form API1 to API 2 on Power Query

I have been using API1 to pull individual files inot Excel Power Query using the syntax below. Can anyone help with correct syntax under API2 please?  My whole company reporting collapsed overnight. Thisiis my old path

 

https://api-content.dropbox.com/1/files/auto/DataModel/SourceFiles/Dates.xlsx?access_token=<ACCESS_TOKEN_REDACTED>

 

DataModel is a folder at the top of dropbox not an App folder as you can't share those.

 

Really appreciate any help as not a developer so don't understand the detial of the code

 

Mike

4 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    Hi Mike, it looks like you were using the API v1 /files endpoint to download the file content. In API v2, the replacement is /files/download.

     

    The standard way of using that endpoint is via a POST with 'Authorization' and 'Dropbox-API-Arg' headers, as shown in the example in the documentation in the "Request and response formats" section.

     

    If you need to be able to just make a GET to it instead though, that is also supported by using the URL parameters documented 

     

    So, using the example you posted, that would look like:

     

    https://content.dropboxapi.com/2/files/download?authorization=Bearer%20ACCESS_TOKEN_HERE&arg=%7B%22path%22%3A%22%2FDataModel%2FSourceFiles%2FDates.xlsx%22%7D

    Replace ACCESS_TOKEN_HERE with your access token.

     

    By the way, I redacted it from your post, but since you initially posted your access token, 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 on the account security pageOr, you can disable just this access token using the API. You would need to then get a new access token and plug that in to your app instead.

     

    By the way, if you need more time to migrate your app to API v2, we can offer an extension for access to API v1. To request that, please open an API ticket with the relevant app key(s).

     

  • masplin's avatar
    masplin
    Explorer | Level 4
    9 years ago

    That was a bit stupid of me. So do I just delete the app by going to conencted app and then remove the linked app? Then recreate it?

     

    Thanks

     

    Mike

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago
    Hi Mike, you don't need to delete/recreate the app itself. You can just unlink the app here using the 'x' for the app:

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

    That will revoke all of the access tokens for that app on your account. You can then get a new access token for that app on your account, by relinking the app to your account the same way you did originally.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If 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, Facebook or Instagram.

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!