We Want to Hear From You! What Do You Want to See on the Community? Tell us here!

Forum Discussion

josuegomes's avatar
josuegomes
Helpful | Level 6
3 years ago
Solved

File revisions are not moved

File has several revisions:

$ curl "https://api.dropboxapi.com/2/files/list_revisions" --header "Authorization: Bearer <>" --header "Content-Type: application/json" --data '{"limit":10,"mode":"path","path":"/Work/versions/Budget.xlsx"}'


{"is_deleted": false, "entries": [{"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKg5w", "client_modified": "2020-01-31T21:23:38Z", "server_modified": "2022-08-26T13:04:45Z", "rev": "5e7248ee5dfda003edfac", "size": 114236, "is_downloadable": true, "content_hash": "d63f98efdeba40f1672d80feded27ac5c9851603df3892d2c986c5c69fa79caf"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKg5w", "client_modified": "2022-04-11T14:49:31Z", "server_modified": "2022-08-26T13:03:34Z", "rev": "5e7248aa8065f003edfac", "size": 238648, "is_downloadable": true, "content_hash": "dcf19e77a928f74cd1fc285d5c33415e4aaf7493719034e12914f74a30f0d4fb"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKg5w", "client_modified": "2022-04-11T13:57:47Z", "server_modified": "2022-08-26T13:03:26Z", "rev": "5e7248a2bb0dd003edfac", "size": 15754, "is_downloadable": true, "content_hash": "2b9749bf8cb7747e8086b0fc0811d243060a0c7afa884ff6c550ba2f7fa8b6be"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKgmw", "client_modified": "2022-04-11T14:49:31Z", "server_modified": "2022-08-17T10:51:20Z", "rev": "5e66da526ecb9003edfac", "size": 238648, "is_downloadable": true, "content_hash": "dcf19e77a928f74cd1fc285d5c33415e4aaf7493719034e12914f74a30f0d4fb"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKgmw", "client_modified": "2022-04-11T13:57:47Z", "server_modified": "2022-08-17T10:51:13Z", "rev": "5e66da4bc3bf3003edfac", "size": 15754, "is_downloadable": true, "content_hash": "2b9749bf8cb7747e8086b0fc0811d243060a0c7afa884ff6c550ba2f7fa8b6be"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKRrw", "client_modified": "2018-06-27T11:01:50Z", "server_modified": "2022-06-29T21:34:05Z", "rev": "5e29ce99fc7aa003edfac", "size": 22885, "is_downloadable": true, "content_hash": "c7853a226648a218f3b80227c746f13c57d2bb789771f02b8d8f881f3965d83c"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKRrw", "client_modified": "2022-04-11T13:57:47Z", "server_modified": "2022-06-29T21:08:17Z", "rev": "5e29c8d595ec9003edfac", "size": 15754, "is_downloadable": true, "content_hash": "2b9749bf8cb7747e8086b0fc0811d243060a0c7afa884ff6c550ba2f7fa8b6be"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKRrg", "client_modified": "2022-04-11T13:57:47Z", "server_modified": "2022-06-29T21:01:25Z", "rev": "5e29c74cbb736003edfac", "size": 15754, "is_downloadable": true, "content_hash": "2b9749bf8cb7747e8086b0fc0811d243060a0c7afa884ff6c550ba2f7fa8b6be"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKRrQ", "client_modified": "2022-04-11T14:50:02Z", "server_modified": "2022-06-29T21:00:45Z", "rev": "5e29c725c9f01003edfac", "size": 119673, "is_downloadable": true, "content_hash": "d555aeb8c6a4cd830f80947daed0b9aa39808d1f22498ca083884395586204d0"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/budget.xlsx", "path_display": "/Work/versions/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKRrA", "client_modified": "2022-04-11T14:49:31Z", "server_modified": "2022-06-29T20:59:47Z", "rev": "5e29c6ef4d1e2003edfac", "size": 238648, "is_downloadable": true, "content_hash": "dcf19e77a928f74cd1fc285d5c33415e4aaf7493719034e12914f74a30f0d4fb"}]}

 

Moving a file with move api https://www.dropbox.com/developers/documentation/http/documentation#files-move.

No errors:

 

$ curl "https://api.dropboxapi.com/2/files/move_v2" --header "Authorization: Bearer <>" --header "Content-Type: application/json" --data '{"allow_ownership_transfer":false,"allow_shared_folder":false,"autorename":false,"from_path":"/Work/versions/Budget.xlsx","to_path":"/Work/versions/copy/Budget.xlsx"}'

 

The revisions don't show in the moved file:

$ curl "https://api.dropboxapi.com/2/files/list_revisions" --header "Authorization: Bearer <>" --header "Content-Type: application/json" --data '{"limit":10,"mode":"path","path":"/Work/versions/copy/Budget.xlsx"}'

 

{"is_deleted": false, "entries": [{"name": "Budget.xlsx", "path_lower": "/work/versions/copy/budget.xlsx", "path_display": "/Work/versions/copy/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKg5w", "client_modified": "2020-01-31T21:23:38Z", "server_modified": "2022-08-26T14:06:26Z", "rev": "5e7256b7b5fa2003edfac", "size": 114236, "is_downloadable": true, "content_hash": "d63f98efdeba40f1672d80feded27ac5c9851603df3892d2c986c5c69fa79caf"}, {"name": "Budget.xlsx", "path_lower": "/work/versions/copy/budget.xlsx", "path_display": "/Work/versions/copy/Budget.xlsx", "id": "id:teAlu1WEq40AAAAAAAKgmw", "client_modified": "2022-04-11T14:49:31Z", "server_modified": "2022-08-26T13:01:46Z", "rev": "5e7248434462b003edfac", "size": 238648, "is_downloadable": true, "content_hash": "dcf19e77a928f74cd1fc285d5c33415e4aaf7493719034e12914f74a30f0d4fb"}]}

 

 

 

  • Greg-DB's avatar
    Greg-DB
    3 years ago

    Yes, that's expected. You're using the "id" mode, so it shows the history of the file with the supplied ID across moves, including the revision of the file at each location where it is/was.

3 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 years ago

    The file revision history doesn't follow a file when it is moved to another path. You can get the file revision history for a file across moves though by setting "mode" to "id" instead of "path" though. Refer to the /2/files/list_revisions documentation for more information.

  • josuegomes's avatar
    josuegomes
    Helpful | Level 6
    3 years ago

    Using the file id the behavior is even more bizarre. A revision is added after each move. Is this expected?

     

    $ curl "https://api.dropboxapi.com/2/files/list_revisions" --header "Authorization: Bearer " --header "Content-Type: application/json" --data '{"limit":10,"mode":"id","path":"id:teAlu1WEq40AAAAAAAKg9Q"}'

     

    {"is_deleted": false, "entries": [{"name": "ada.jpg", "path_lower": "/work/ver/ada.jpg", "path_display": "/Work/ver/ada.jpg", "id": "id:teAlu1WEq40AAAAAAAKg9Q", "client_modified": "2019-07-30T21:11:19Z", "server_modified": "2022-08-29T20:40:07Z", "rev": "5e76744f356ba003edfac", "size": 99003, "is_downloadable": true, "content_hash": "a1feb184b8b5723de4f3d16e8530c71759c4a569bc368b0ee88a3acdde9310df"}]}

     

    $ curl "https://api.dropboxapi.com/2/files/move_v2" --header "Authorization: Bearer " --header "Content-Type: application/json" --data '{"allow_ownership_transfer":false,"allow_shared_folder":false,"autorename":false,"from_path":"id:teAlu1WEq40AAAAAAAKg9Q","to_path":"/Work/ver/copy/ada.jpg"}'

     

    {"metadata": {".tag": "file", "name": "ada.jpg", "path_lower": "/work/ver/copy/ada.jpg", "path_display": "/Work/ver/copy/ada.jpg", "id": "id:teAlu1WEq40AAAAAAAKg9Q", "client_modified": "2019-07-30T21:11:19Z", "server_modified": "2022-08-29T20:41:50Z", "rev": "5e7674b15c34c003edfac", "size": 99003, "is_downloadable": true, "content_hash": "a1feb184b8b5723de4f3d16e8530c71759c4a569bc368b0ee88a3acdde9310df"}}

     

    $ curl "https://api.dropboxapi.com/2/files/list_revisions" --header "Authorization: Bearer " --header "Content-Type: application/json" --data '{"limit":10,"mode":"id","path":"id:teAlu1WEq40AAAAAAAKg9Q"}'

     

    {"is_deleted": false, "entries": [{"name": "ada.jpg", "path_lower": "/work/ver/copy/ada.jpg", "path_display": "/Work/ver/copy/ada.jpg", "id": "id:teAlu1WEq40AAAAAAAKg9Q", "client_modified": "2019-07-30T21:11:19Z", "server_modified": "2022-08-29T20:41:50Z", "rev": "5e7674b15c34c003edfac", "size": 99003, "is_downloadable": true, "content_hash": "a1feb184b8b5723de4f3d16e8530c71759c4a569bc368b0ee88a3acdde9310df"}, {"name": "ada.jpg", "path_lower": "/work/ver/ada.jpg", "path_display": "/Work/ver/ada.jpg", "id": "id:teAlu1WEq40AAAAAAAKg9Q", "client_modified": "2019-07-30T21:11:19Z", "server_modified": "2022-08-29T20:40:07Z", "rev": "5e76744f356ba003edfac", "size": 99003, "is_downloadable": true, "content_hash": "a1feb184b8b5723de4f3d16e8530c71759c4a569bc368b0ee88a3acdde9310df"}]}

     

     

     

     

     

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    3 years ago

    Yes, that's expected. You're using the "id" mode, so it shows the history of the file with the supplied ID across moves, including the revision of the file at each location where it is/was.

About Discuss Dropbox Developer & API

Node avatar for Discuss Dropbox Developer & API
Make connections with other developers814 PostsLatest Activity: 3 years ago
274 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!