cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to know what we learned at IBC? Check out our learnings on media, remote working and more right here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

I want to save a file outside of the Apps folder

I want to save a file outside of the Apps folder

ms97
Explorer | Level 3

Hello!
I am currently saving files in my 'Apps' folder using the files_upload() API. I want to save files in a seperate environment than 'Apps' where users are already looking. I believe my Dropbox key has permission to do this, but I cannot figure out the path settings to get this to integrate correctly.

 

folder = 'testing'
        filename = 'test_12_28_23'
        path = '/AccountingCloseoutFiles/' + folder + '/' + filename
        myRange = np.arange(1,1001,1)
        df = pd.DataFrame({"numbers": myRange})
        try:
             with io.BytesIO() as stream:
                with pd.ExcelWriter(stream) as writer:
                    df.to_excel(writer, sheet_name='test',
                                    index=False)
                stream.seek(0)
                dbx.files_upload(stream.getvalue(),
                                 path,
                                 mode=dropbox.files.WriteMode.overwrite)
        except Exception as e:
            logger.critical('File was unable to be saved to dropbox.')
            logger.critical(f'Error: {e}')
            sys.exit(1)

 

This code works, but it stores data in 'Apps' instead of the 'AccoutingCloseoutFiles' parent folder that I want it in.

 

Any help is appreciated! 

6 Replies 6

Здравко
Legendary | Level 20

Hi @ms97,

No, your application doesn't have such permission. You have limited your application permission to access (not only save) files and/or folders within app specific folder only and nothing outside. That's your choice! As seems, this choice is unintentional. You need full access application, not app' folder type! Unfortunately, such permission cannot get changed (unlike other permissions, like scopes, for instance). You need to recreate your application and select correct application type at creation moment (as noted, later cannot change).

Hope this helps.

Greg-DB
Dropbox Staff

@ms97 Ð—дравко is correct; you cannot change the access type ("app folder" versus "full Dropbox") on an existing app. You can find more information on access types here. You can register a new app with full Dropbox access here.

ms97
Explorer | Level 3

Thank you for the information! My app has full Dropbox access already, but no matter what path I give it, it is stored in the App folder.  I have two apps one is limited to 'App folder' and one is not.  When using bi_automation, it still only stores files inside the app folder. Is there a way to change this?

Screenshot 2023-12-29 at 8.24.00 AM.png

Здравко
Legendary | Level 20

@ms97 wrote:

...  When using bi_automation, it still only stores files inside the app folder. ...


What do you mean when you say "using bi_automation"? ðŸ¤” Did you change only the app key only and continue use the existing tokens or perform full re-authentication? 🙂

ms97
Explorer | Level 3

I did a full re authentification using a new app

Greg-DB
Dropbox Staff

@ms97 If you perform an upload using the Dropbox API and it is automatically rooted in the app folder, that means you are using an access token for the app for that app folder.

 

Registering and authorizing a new app with full Dropbox access won't change existing access tokens (or refresh tokens); existing access tokens (and refresh tokens) for the app folder app will continue to only have access to the app folder. To upload outside the app folder, you'd need to switch to using an access token for the full Dropbox app instead.

 

To address this, get an access token (and refresh token, if using) for the full Dropbox app, and update your app as needed to make sure that it is using an access token (and refresh token, if using) for the full Dropbox app in the creation of the 'dbx' object that you're using to perform the upload.

 

 

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    ms97 Explorer | Level 3
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?