Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
masplin
Impactful Individual
Impactful Individual

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 26
v-yuezhe-msft
Employee
Employee

@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

1.JPG

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

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

 

Capture.PNG

 

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

 

Thanks

Mike

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.PBI.png

 

masplin
Impactful Individual
Impactful Individual

let an "s" of the file name Duh!!!!

 

Brilliant

masplin
Impactful Individual
Impactful Individual

Ok so I got a repsonse from the API explorer uses this token and path, and can download the file however i then put this code in Power Query and get an error "unable to conenct to the remote server"? Any idea?

 

let
    Source = Excel.Workbook(Web.Contents("https://content.dropboxapi.com/2/files/download", [Headers=[Authorization="Bearer lkPfa4vOd-AAAAAAAAAAXpFuGV2UKJk0D3WGQtPjNeIeZNwdopvcaSs_y3gguRYY", #"Dropbox-API-Arg"="{""path"": ""/DataModel/SourceFiles/Inputs.xlsx""}"]]), null, true)
in
    Source

That, I am not sure about. 

 

I was able to finally get our entire system up and running again. I updated ONLY the first line of code in each query under the Advanced Editor (only the code highlighted in blue below) as shown below. I left all other code the same and all queries now return with no error.

PBI2.png

 

 

 

masplin
Impactful Individual
Impactful Individual

Must have been an issue on my workcomputer as now works fine.

 

Last question as you can see in my old API1 code I used 2 subset queries one ot hold the Token and one to hold the path. Made it easier if either changed. 

 

I tried this code by doesn't seem to work unless you write both out in full

 

let
    Source = Excel.Workbook(Web.Contents("https://content.dropboxapi.com/2/files/download", [Headers=[Authorization="Bearer Token", #"Dropbox-API-Arg"="{""path"": ""DropboxSourcePath & Inputs.xlsx""}"]]), null, true)
in
    Source

Where DropboxSourcePath is 

 

let
    Source = "/DataModel/SourceFiles/"
in
    Source

 and Token is

 

let
    Source = "lkPfa4vOd-AAAAAAAAAAKjmGh93HWPeYF-CY0LSTVss5JF53HOGK46xxk"
in
    Source

Assume i have an error in my syntax?

 

Mike

Dindo
Frequent Visitor

If you're running with on premise gateway, how would you add this data source?

In V1 it's easy since it reads as a web url source. Anyone has luck trying this out?

masplin
Impactful Individual
Impactful Individual

The code above works fine except you have to put the exact tokena nd path in the source line.  i managed to get it to read the table.

 

I'm just hoping to be able to use some sub queries ot make it look neater and easier to manage

Anonymous
Not applicable

your code (below) works only on PBI Desktop.

once it is published, it gets credential error on PBI Service.

is there any workaround to make it work and refresh on PBI Service?

 

let
Source = Excel.Workbook(Web.Contents("https://content.dropboxapi.com/2/files/download", [Headers=[Authorization="Bearer mytoken", #"Dropbox-API-Arg"="{""path"": ""/myfolder/myfile.xlsx""}"]]), null, true)

in
#"Source"

 

error.png

You are exactly right. I just went to the service to change our refresh schedule and noticed the error. I am looking into it now and will report back if I find a solution. Sorry about that!

masplin
Impactful Individual
Impactful Individual

Hmm wierd as works fine for me on the srvice. I updated al lmy sources in desktop, republished and it just worked? did even touch the credentials.

Anonymous
Not applicable

yeah, I know. I suspect there is an issue in my Brazilian server from PBI Service, as i have another dropbox project that I know works on US east (Virginia) but does not work here.

where is your PBI Service data being stored? USA? other place?

which version are you using?

 

I am under:

Version 13.0.2597.188
Activity ID nah
TimeTue Oct 03 2017 17:34:25 GMT-0300 (Hora oficial do Brasil)
Your data is stored inBrazil South (Sao Paulo State)

masplin
Impactful Individual
Impactful Individual

where do you find that info? I'm in UK so guess some european host

masplin
Impactful Individual
Impactful Individual

north europe (ireland)

Anonymous
Not applicable

at the upper right corner, click "?" button, and go to About Power BI.

My info:

Version13.0.2597.188

Activity ID......
TimeTue Oct 03 2017 15:54:20 GMT-0500 (Central Daylight Time)
Your data is stored inNorth Central US (Illinois)

 

Error screenshots from service:

 

PBI3.pngPBI4.png

masplin
Impactful Individual
Impactful Individual

Sorry I have no idea as not really a techy. 

masplin
Impactful Individual
Impactful Individual

seems  i have misled everyone. I rechecked and doesnt seem I had applied the source changes in my model. i just did republished and now have the same error as you guys. That's a little frustrating to say the least. 

 

Mike

@masplin,

I get same error as yours when enter credential for Dropbox in Power BI Service, the workaround is to republish PBIX file each time you have refresh.

Meanwhile, I would recommend you vote up the following idea that add Dropbox connector in Power BI.
https://ideas.powerbi.com/forums/265200-power-bi-ideas/suggestions/6663925-dropbox

In addition, do mask sensitive data such as access token before uploading your pictures and posting your replies.

Regards,
Lydia

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors
Top Kudoed Authors