Forum Discussion

masplin's avatar
masplin
Impactful Individual
8 years ago

Dropbox API v2, as API1 has been turned off

Hi

 

I have been linking severla single files stored on dropbox using API! whiuch seems to have bene disabled last night. I think there are a lot of us in the same boat.  Can someone say what the equivalent code is for API2?  I tried change the path to "https://api.dropboxapi.com/2/files/auto/DataModel/SourceFiles/" but that just errors.  My files are just sitting in a normal dropbox folder as can't us an App folder as can't be shared. 

 

The code i was using was

 

let
    Source = Excel.Workbook(Web.Contents(DropboxSourcePath & "Inputs.xlsx" & Token), null, true),
    Centre_Table = Source{[Item="Centre",Kind="Table"]}[Data],
    #"Changed Type" = Table.TransformColumnTypes(Centre_Table,{{"Opening Date", type date}})
in
    #"Changed Type"

Where  Dropboxsourcepath

 

let
    Source = "https://api-content.dropbox.com/1/files/auto/DataModel/SourceFiles/"
in
    Source

and token

 

let
    Source = "?access_token=xxxxxxxxxxxxxxxxxxxxxxx"
in
    Source

Grateful any advice as whole company reporting has collapsed

 

Thanks

Mike

26 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    masplin,

    Do mask sensitive data before uploading scripts or screenshots.

    In your scenario, add a new blank query in Power BI Desktop, then paste the following code into the Advanced Editor of your query.

    let
        Source = Excel.Workbook(Web.Contents("https://content.dropboxapi.com/2/files/download", [Headers=[Authorization="Bearer <your access token>", #"Dropbox-API-Arg"="{""path"": ""/folder/path/filename.xlsx""}"]]), null, true)
    in
        Source



    And I would commend you firstly test that if your API returns correct result in DropBox API Explorer.


    Regards,
    Lydia

    • masplin's avatar
      masplin
      Impactful Individual

      Hi Lydia

       

      I'm obviously doing somethnig stupid.  the path to my file is U:\Dropbox\DataModel\SourceFiles\Input.xlsx

       

      In API explorer I got this

       

       

      Can you tell me where i've gone wrong please?

       

      Thanks

      Mike

      • granthworth's avatar
        granthworth
        Kudo Kingpin

        Hey masplin

         

        I am still working on getting ours resolved also. I have not gotten around the issue completely yet but I was able to get at least a portion of Lydia's fix to work. See below for my info. Hope this helps.