We are aware of the issue with the badge emails resending to everyone, we apologise for the inconvenience - learn more here.

Forum Discussion

cvc_dolphin's avatar
cvc_dolphin
Explorer | Level 4
7 years ago

Dropbox REST API to update file's metadata

I want to rename a file with dropbox rest api.

Well, it's possible with /move_v2 but we need to provide from_path and to_path values.

 

In my understanding, renaming a file is just updating its metadata. As dropbox provides an api to get metadata, is there any way to update it. I mean provided the id of file, can I change it's metadata?

 

I have posted my concern regading this on stackoverflow here

 

Can anyone help me resolve this? 

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    Using /2/files/move_v2 is the correct way to rename a file, even if you don't need to move its folder location.

    For example, to rename a file inside a "Documents" folder, you would supply values like:

     

     

    from_path:"/Documents/old_name", to_path:"/Documents/new_name"


    Or, using the ID, you would still use move_v2, with values like:

     

     

    from_path:"id:abcfileid", to_path:"/Documents/new_name"


    Or, you can even use values relative to the parent folder ID, like:

     

    from_path:"id:xyzfolderid/old_name", to_path:"id:xyzfolderid/new_name"
    • cvc_dolphin's avatar
      cvc_dolphin
      Explorer | Level 4

      Fab...!

       

      Yes, we  can rename a file in multiple ways but we either need to have a complete or relative path to file. What if I want to rename a file provided its id only? 

      I mean other provders like google drive, one drive, box provide a way to deal with file metadata. Whereas, dropbox is providing only a way to access only file metadata but not to update it.

      So I was wondering if there is any way to deal with such operation when I am having only the id of a file.

       

      Thanking you in anticipation 

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff
        Thanks for following up. The Dropbox API doesn't offer a way to rename the file using just its id and new name without specifying the new path, but I'll pass this along as a feature request.