cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

sharing url files using iframe

sharing url files using iframe

arch2020
Helpful | Level 5

Hi all,

 

I am trying to access my files, through generating shared url, which I managed to do using python for my website. I am trying to implement an iframe 3d model viewer, which require a certain file with dxf or dwg extension, which typically generated from CAD file. However, when I provide the url and change the dl=1 or use raw=1, as shown below:

 

https://www.dropbox.com/s/example/skyline.dxf?dl=1

 

https://www.dropbox.com/s/example/skyline.dxf?raw=1

 

I also looked at the dropbox documents regarding to embedding files--that didn;t help me much because it uses dropbox to view the files. my iframe require using a certain viewer which only need direct access to the file.

 

Is there a better way to access and provide a driect link to the file, to view the model?

 

Thank you for feebacks in advance

3 Replies 3

Greg-DB
Dropbox Staff

Using the raw=1 parameter, as documented here, is the right way to get direct access to the file content from a shared link like this. It sounds like that's not working for you though. Are you getting any particular error or unexpected output?

 

Note that the client will need to be able to follow redirects, so if your viewer doesn't support that, that may be the issue.

 

Alternatively, if temporary links would work for your use case, you could get temporary direct links (which don't require a redirect or URL parameter modification) by calling /2/files/get_temporary_link, which is available as files_get_temporary_link in the official Dropbox Python SDK.

arch2020
Helpful | Level 5

@Greg-DB

Many thanks for your prompt response, much appreciated. I tried using the temporary link but with no success, the viewer keep showing me the loading page but the status never change. I guess I have to dig deeper to find out what is not working.

 

I just noted while using files_get_temporary_link will generate a link with other metadata. Is there a direct method to only retrieve the temporary link as str?

Greg-DB
Dropbox Staff

No, there isn't another call like that with a string returned directly. You should access the string in the returned GetTemporaryLinkResult.link field. Does accessing that field not work in your environment for some reason?

 

As for viewing the file itself, you may want to check the JavaScript console for the page where the viewer isn't successfully loading the file, in case there's some helpful error or output there.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    arch2020 Helpful | Level 5
What do Dropbox user levels mean?