<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: restored folders and files have different ids than their originally added entities in Discuss Dropbox Developer &amp; API</title>
    <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/restored-folders-and-files-have-different-ids-than-their/m-p/691751#M3421</link>
    <description>&lt;P&gt;In the "restore file1" step, you're only restoring the file itself, not the original folder. When adding or restoring a file, if a parent path component (the folder, in this case) doesn't already exist, it will be automatically created. That automatically created folder is a new folder, not a restored folder (and it may or may not be at the same path as the original parent folder, e.g., since you can restore a file to a different location).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for the file ID of the restored file itself, I would expect that to be the same, and it is in my testing. Here's an example I just ran through:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl -X POST https://api.dropboxapi.com/2/files/create_folder_v2 \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder"}'

# {
#   "metadata": {
#     "name": "test_691719_folder",
#     "path_lower": "/test_691719_folder",
#     "path_display": "/test_691719_folder",
#     "id": "id:25N5ksooX-sAAAAAAAQyqA"
#   }
# }  

curl -X POST https://content.dropboxapi.com/2/files/upload \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/octet-stream' \
  --header 'Dropbox-API-Arg: {"path":"/test_691719_folder/test_691719_file"}' \
  --data-binary @'test.txt'

# {
#   "name": "test_691719_file",
#   "path_lower": "/test_691719_folder/test_691719_file",
#   "path_display": "/test_691719_folder/test_691719_file",
#   "id": "id:25N5ksooX-sAAAAAAAQyqQ",
#   "client_modified": "2023-06-14T18:42:28Z",
#   "server_modified": "2023-06-14T18:42:29Z",
#   "rev": "5fe1b50581a7c021eccc7",
#   "size": 27,
#   "is_downloadable": true,
#   "content_hash": "cceac37da5288a6b6716737310c14305c9b16a6e0ff0abce4a306c3de3a59f75"
# }

curl -X POST https://api.dropboxapi.com/2/files/delete_v2 \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder"}'

# {
#   "metadata": {
#     ".tag": "folder",
#     "name": "test_691719_folder",
#     "path_lower": "/test_691719_folder",
#     "path_display": "/test_691719_folder",
#     "id": "id:25N5ksooX-sAAAAAAAQyqA"
#   }
# }

curl -X POST https://api.dropboxapi.com/2/files/restore \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder/test_691719_file","rev":"5fe1b50581a7c021eccc7"}'

# {
#   "name": "test_691719_file",
#   "path_lower": "/test_691719_folder/test_691719_file",
#   "path_display": "/test_691719_folder/test_691719_file",
#   "id": "id:25N5ksooX-sAAAAAAAQyqQ",
#   "client_modified": "2023-06-14T18:42:28Z",
#   "server_modified": "2023-06-14T18:43:47Z",
#   "rev": "5fe1b5501cafb021eccc7",
#   "size": 27,
#   "is_downloadable": true,
#   "content_hash": "cceac37da5288a6b6716737310c14305c9b16a6e0ff0abce4a306c3de3a59f75"
# }  

curl -X POST https://api.dropboxapi.com/2/files/get_metadata \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder"}'

# {
#   ".tag": "folder",
#   "name": "test_691719_folder",
#   "path_lower": "/test_691719_folder",
#   "path_display": "/test_691719_folder",
#   "id": "id:25N5ksooX-sAAAAAAAQyrA"
# }

curl -X POST https://api.dropboxapi.com/2/files/get_metadata \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder/test_691719_file"}'  

# {
#   ".tag": "file",
#   "name": "test_691719_file",
#   "path_lower": "/test_691719_folder/test_691719_file",
#   "path_display": "/test_691719_folder/test_691719_file",
#   "id": "id:25N5ksooX-sAAAAAAAQyqQ",
#   "client_modified": "2023-06-14T18:42:28Z",
#   "server_modified": "2023-06-14T18:43:47Z",
#   "rev": "5fe1b5501cafb021eccc7",
#   "size": 27,
#   "is_downloadable": true,
#   "content_hash": "cceac37da5288a6b6716737310c14305c9b16a6e0ff0abce4a306c3de3a59f75"
# }&lt;/LI-CODE&gt;
&lt;P&gt;If something's not working properly for you though, please share the steps/code to reproduce the issue and show us the unexpected output or error so we can look into it.&lt;/P&gt;</description>
    <pubDate>Wed, 14 Jun 2023 18:57:16 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2023-06-14T18:57:16Z</dc:date>
    <item>
      <title>restored folders and files have different ids than their originally added entities</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/restored-folders-and-files-have-different-ids-than-their/m-p/691719#M3420</link>
      <description>&lt;P&gt;given dropbox UI has no folders or files in it&lt;/P&gt;&lt;P&gt;when I create a subfolder&lt;/P&gt;&lt;P&gt;and add file1 to the subfolder&lt;/P&gt;&lt;P&gt;and add file2 to the subfolder&lt;/P&gt;&lt;P&gt;and note the ids for the new subfolder and two new files&lt;/P&gt;&lt;P&gt;and when I delete the subfolder&lt;/P&gt;&lt;P&gt;and when I restore file1&lt;/P&gt;&lt;P&gt;then the restored subfolder id is different than the originally added one in step 2&lt;/P&gt;&lt;P&gt;and the restored file1 id is different than the originally added one in step 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;why is this?&amp;nbsp; it seems like an entity's id (primary key for folder or file) should always stay the same whether it is deleted, restored or whatever.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 17:14:33 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/restored-folders-and-files-have-different-ids-than-their/m-p/691719#M3420</guid>
      <dc:creator>sbrownnw</dc:creator>
      <dc:date>2023-06-14T17:14:33Z</dc:date>
    </item>
    <item>
      <title>Re: restored folders and files have different ids than their originally added entities</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/restored-folders-and-files-have-different-ids-than-their/m-p/691751#M3421</link>
      <description>&lt;P&gt;In the "restore file1" step, you're only restoring the file itself, not the original folder. When adding or restoring a file, if a parent path component (the folder, in this case) doesn't already exist, it will be automatically created. That automatically created folder is a new folder, not a restored folder (and it may or may not be at the same path as the original parent folder, e.g., since you can restore a file to a different location).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As for the file ID of the restored file itself, I would expect that to be the same, and it is in my testing. Here's an example I just ran through:&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;curl -X POST https://api.dropboxapi.com/2/files/create_folder_v2 \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder"}'

# {
#   "metadata": {
#     "name": "test_691719_folder",
#     "path_lower": "/test_691719_folder",
#     "path_display": "/test_691719_folder",
#     "id": "id:25N5ksooX-sAAAAAAAQyqA"
#   }
# }  

curl -X POST https://content.dropboxapi.com/2/files/upload \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/octet-stream' \
  --header 'Dropbox-API-Arg: {"path":"/test_691719_folder/test_691719_file"}' \
  --data-binary @'test.txt'

# {
#   "name": "test_691719_file",
#   "path_lower": "/test_691719_folder/test_691719_file",
#   "path_display": "/test_691719_folder/test_691719_file",
#   "id": "id:25N5ksooX-sAAAAAAAQyqQ",
#   "client_modified": "2023-06-14T18:42:28Z",
#   "server_modified": "2023-06-14T18:42:29Z",
#   "rev": "5fe1b50581a7c021eccc7",
#   "size": 27,
#   "is_downloadable": true,
#   "content_hash": "cceac37da5288a6b6716737310c14305c9b16a6e0ff0abce4a306c3de3a59f75"
# }

curl -X POST https://api.dropboxapi.com/2/files/delete_v2 \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder"}'

# {
#   "metadata": {
#     ".tag": "folder",
#     "name": "test_691719_folder",
#     "path_lower": "/test_691719_folder",
#     "path_display": "/test_691719_folder",
#     "id": "id:25N5ksooX-sAAAAAAAQyqA"
#   }
# }

curl -X POST https://api.dropboxapi.com/2/files/restore \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder/test_691719_file","rev":"5fe1b50581a7c021eccc7"}'

# {
#   "name": "test_691719_file",
#   "path_lower": "/test_691719_folder/test_691719_file",
#   "path_display": "/test_691719_folder/test_691719_file",
#   "id": "id:25N5ksooX-sAAAAAAAQyqQ",
#   "client_modified": "2023-06-14T18:42:28Z",
#   "server_modified": "2023-06-14T18:43:47Z",
#   "rev": "5fe1b5501cafb021eccc7",
#   "size": 27,
#   "is_downloadable": true,
#   "content_hash": "cceac37da5288a6b6716737310c14305c9b16a6e0ff0abce4a306c3de3a59f75"
# }  

curl -X POST https://api.dropboxapi.com/2/files/get_metadata \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder"}'

# {
#   ".tag": "folder",
#   "name": "test_691719_folder",
#   "path_lower": "/test_691719_folder",
#   "path_display": "/test_691719_folder",
#   "id": "id:25N5ksooX-sAAAAAAAQyrA"
# }

curl -X POST https://api.dropboxapi.com/2/files/get_metadata \
  --header 'Authorization: Bearer &amp;lt;ACCESS_TOKEN&amp;gt;' \
  --header 'Content-Type: application/json' \
  --data '{"path":"/test_691719_folder/test_691719_file"}'  

# {
#   ".tag": "file",
#   "name": "test_691719_file",
#   "path_lower": "/test_691719_folder/test_691719_file",
#   "path_display": "/test_691719_folder/test_691719_file",
#   "id": "id:25N5ksooX-sAAAAAAAQyqQ",
#   "client_modified": "2023-06-14T18:42:28Z",
#   "server_modified": "2023-06-14T18:43:47Z",
#   "rev": "5fe1b5501cafb021eccc7",
#   "size": 27,
#   "is_downloadable": true,
#   "content_hash": "cceac37da5288a6b6716737310c14305c9b16a6e0ff0abce4a306c3de3a59f75"
# }&lt;/LI-CODE&gt;
&lt;P&gt;If something's not working properly for you though, please share the steps/code to reproduce the issue and show us the unexpected output or error so we can look into it.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 18:57:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/restored-folders-and-files-have-different-ids-than-their/m-p/691751#M3421</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2023-06-14T18:57:16Z</dc:date>
    </item>
    <item>
      <title>Re: restored folders and files have different ids than their originally added entities</title>
      <link>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/restored-folders-and-files-have-different-ids-than-their/m-p/691762#M3422</link>
      <description>&lt;P&gt;I see, the folder being created after the file being restored was causing the failure I was seeing.&amp;nbsp; Yes, you are correct, the folder is a different entity (not sure why, with a different Id) but the restored file has the same Id as the originally added one.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Jun 2023 19:57:49 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Discuss-Dropbox-Developer-API/restored-folders-and-files-have-different-ids-than-their/m-p/691762#M3422</guid>
      <dc:creator>sbrownnw</dc:creator>
      <dc:date>2023-06-14T19:57:49Z</dc:date>
    </item>
  </channel>
</rss>

