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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
yhogebrug
Frequent Visitor

Dropbox API | How to specify Dropbox-API-Path-Root Header in Web.Contents call?

There has been an update in Dropbox and also in the API a couple of weeks ago. It is now necessary to specify the root to get your documents from Dropbox. I came along this newsitem where they explain how to implement this. The following is explained in that newsitem:

yhogebrug_0-1701952785394.png

How can I implement this in my Power BI code? It was working before, but now it seems that I have to extent the header. The problem here is that I have to give a nested list in the parameter 'Dropbox-API-Path-Root' I think. I tried a couple of things, like:

 

header = [  #"Authorization"="Bearer "&token,
            #"Content-Type"= "application/json", 
            #"Dropbox-API-Path-Root" = [#".tag" = "root", root = "xxxxxxxxxx"]]
response = Web.Contents("https://api.dropboxapi.com/2/files/list_folder", [Content=Json.FromValue(data), Headers=header]),

 

where the value for root is the root_namespace_id, but this gives me an error that a value from type Record can't be converted to type Text. And i tried:

 

header = [  #"Authorization"="Bearer "&token,
            #"Content-Type"= "application/json", 
            #"Dropbox-API-Path-Root" = ".tag = 'root', root = 'xxxxxxxxxx'"]
response = Web.Contents("https://api.dropboxapi.com/2/files/list_folder", [Content=Json.FromValue(data), Headers=header]),

 

where I get a 400 Bad Request error. 

 

Can someone explain me how I can specify the root when connecting to the Dropbox API?

1 ACCEPTED SOLUTION
yhogebrug
Frequent Visitor

For someone having the same problem in the future, this is how I solved it, which was actually pretty close to the first try...

header = [  #"Authorization"="Bearer "&token,
            #"Content-Type"= "application/json", 
            #"Dropbox-API-Path-Root" = Text.FromBinary(Json.FromValue([#".tag" = "root", root = "xxxxxxxxxx"]))]
response = Web.Contents("https://api.dropboxapi.com/2/files/list_folder", [Content=Json.FromValue(data), Headers=header]),

So, adding Text.FromBinary and Json.FromValue seems to let you be able to give a nested list in the header from the Web.Contents call, anyway in this case🥳.

View solution in original post

6 REPLIES 6
yhogebrug
Frequent Visitor

For someone having the same problem in the future, this is how I solved it, which was actually pretty close to the first try...

header = [  #"Authorization"="Bearer "&token,
            #"Content-Type"= "application/json", 
            #"Dropbox-API-Path-Root" = Text.FromBinary(Json.FromValue([#".tag" = "root", root = "xxxxxxxxxx"]))]
response = Web.Contents("https://api.dropboxapi.com/2/files/list_folder", [Content=Json.FromValue(data), Headers=header]),

So, adding Text.FromBinary and Json.FromValue seems to let you be able to give a nested list in the header from the Web.Contents call, anyway in this case🥳.

lbendlin
Super User
Super User

your first version looks ok.  Are you using something different from "/"  as root?

What do you actually mean with "using something different from '/' as root"?

 

I get the following error, which states that a value of type Record can't be converted to type Text:

yhogebrug_0-1702389714622.png

I understand that it gives this error, because my list with header items looks like this:

yhogebrug_1-1702389787428.png

How can I give a list with a record in it, so actually a list with another list in it, to my Web.Contents call?

 

Without the 'Dropbox-API-Path-Root' argument my code works, but it can only get the content from my personal space in Dropbox and not from my organization space. I'm quite sure that I can fix it with the 'Dropbox-API-Path-Root' argument.

 

Do you have any idea what I have to change to make it work?

As you can probably appreciate it is nearly impossible to help with API queries without access to said API  (which you may not be willing to provide for understandable reasons)

I understand and indeed I cannot provide that.

 

But one last question then, because I think that this could be a solution. Is it in general possible to give a nested list to the Web.Contents call in the header? Or is that dependent of the API you use in the Web.Contents call? Because I need to give a 'tag' and a 'root' argument for the argument of 'Dropbox-API-Path-Root'.

Usually payloads go into the request body, not the header.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors