<?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 Upload-session/finish-batch merges all the files appended in that upload session in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-session-finish-batch-merges-all-the-files-appended-in/m-p/563016#M26500</link>
    <description>&lt;P&gt;After creating a new upload session ID using upload-session/start (Sequential), I used upload-session/append to add 2 more files (5120 bytes each) in it and finally called upload-session/finish-batch to complete the upload process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue seems to be in upload-session/finish-batch, which asks me to put the offset value of both the files as the total size of the session id (i.e., 5120 + 5120 = 10240). After doing so it seems like once both the files are uploaded, the bytes of the second file in the session queue were appended to the bytes of both the files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This means if the contents of the first file were "This is first." and the contents of the second file were "This is second.", then the files that upload-session/finish-batch uploads is "This is first.This is second." And this happens to both files. Eventually, if you add a third file in the queue, say "This is third." then the uploaded file contents would be "This is first.This is second.This is third.".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a sample response (noticing how the content hash is the same for both the files which were appended to that upload session using upload-session/append). In this example, the size of the first file is 5120 bytes and the second file is 5307 bytes. And thus upload-session/finish-batch forced to set the offset of both the files to their sum (10427). This seems to have increased size for both the files and there seems no workaround as API refuses to accept any other offsets except this sum.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GameOnCloud_0-1638925894959.png" style="width: 500px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/26504i02075E7F933108D9/image-dimensions/500x349?v=v2" width="500" height="349" role="button" title="GameOnCloud_0-1638925894959.png" alt="GameOnCloud_0-1638925894959.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wasn't able to try&amp;nbsp;upload-session/start (Concurrent) as the API calls were stuck for some reason and didn't close when adding the last file using upload-session/append.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any assistance would be very much appreciated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 14 Dec 2021 19:50:38 GMT</pubDate>
    <dc:creator>GameOnCloud</dc:creator>
    <dc:date>2021-12-14T19:50:38Z</dc:date>
    <item>
      <title>Upload-session/finish-batch merges all the files appended in that upload session</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-session-finish-batch-merges-all-the-files-appended-in/m-p/563016#M26500</link>
      <description>&lt;P&gt;After creating a new upload session ID using upload-session/start (Sequential), I used upload-session/append to add 2 more files (5120 bytes each) in it and finally called upload-session/finish-batch to complete the upload process.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The issue seems to be in upload-session/finish-batch, which asks me to put the offset value of both the files as the total size of the session id (i.e., 5120 + 5120 = 10240). After doing so it seems like once both the files are uploaded, the bytes of the second file in the session queue were appended to the bytes of both the files.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This means if the contents of the first file were "This is first." and the contents of the second file were "This is second.", then the files that upload-session/finish-batch uploads is "This is first.This is second." And this happens to both files. Eventually, if you add a third file in the queue, say "This is third." then the uploaded file contents would be "This is first.This is second.This is third.".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is a sample response (noticing how the content hash is the same for both the files which were appended to that upload session using upload-session/append). In this example, the size of the first file is 5120 bytes and the second file is 5307 bytes. And thus upload-session/finish-batch forced to set the offset of both the files to their sum (10427). This seems to have increased size for both the files and there seems no workaround as API refuses to accept any other offsets except this sum.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="GameOnCloud_0-1638925894959.png" style="width: 500px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/26504i02075E7F933108D9/image-dimensions/500x349?v=v2" width="500" height="349" role="button" title="GameOnCloud_0-1638925894959.png" alt="GameOnCloud_0-1638925894959.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wasn't able to try&amp;nbsp;upload-session/start (Concurrent) as the API calls were stuck for some reason and didn't close when adding the last file using upload-session/append.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any assistance would be very much appreciated&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Dec 2021 19:50:38 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-session-finish-batch-merges-all-the-files-appended-in/m-p/563016#M26500</guid>
      <dc:creator>GameOnCloud</dc:creator>
      <dc:date>2021-12-14T19:50:38Z</dc:date>
    </item>
    <item>
      <title>Re: Upload-session/finish-batch merges all the files appended in that upload session</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-session-finish-batch-merges-all-the-files-appended-in/m-p/563084#M26502</link>
      <description>&lt;P&gt;Hi &lt;a href="https://www.dropboxforum.com/t5/user/viewprofilepage/user-id/1499615"&gt;@GameOnCloud&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;&lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@FBF7D2AB59A0D6E861EBF6A36F93B7E2/emoticons/1f642.png" alt=":slightly_smiling_face:" title=":slightly_smiling_face:" /&gt; Seems, you have misunderstood the meaning of upload session. Let's take a look on upload process at all.&lt;/P&gt;&lt;P&gt;The simplest upload can be performed using &lt;A title="Create a new file with the contents provided in the request." href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload" target="_blank" rel="noopener"&gt;2/files/upload&lt;/A&gt;. Main drawback here is limitation, set to any single HTTP transaction to the Dropbox server, be up to 150MB size. Which mean you can't upload file bigger than 150MB using the call mentioned (or it's not guaranteed at least). Since all files you have mentioned are much smaller, you can use this simplest call without issues.&lt;/P&gt;&lt;P&gt;To upload bigger files, you have to split files content to parts no bigger than 150MB and send the parts to the Dropbox server. You can achieve this using upload session for every one file. Using &lt;A title="Upload sessions allow you to upload a single file in one or more requests, for example where the size of the file is greater than 150 MB." href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-start" target="_blank" rel="noopener"&gt;2/files/upload_session/start&lt;/A&gt;, you can start such a session for single big file upload (according to described by you, you have tried use it for more than 1 file simultaneously &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@D6F1E7339C4A1D356873D19B1E420FB0/emoticons/1f62f.png" alt=":hushed_face:" title=":hushed_face:" /&gt;). The parts of file split before can be added using &lt;A title="Append more data to an upload session." href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-append" target="_blank" rel="noopener"&gt;2/files/upload_session/append_v2&lt;/A&gt;. Once all file parts upload finished, you can finish the session and put the content uploaded within Dropbox file system as a named file using &lt;A title="Finish an upload session and save the uploaded data to the given file path." href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish" target="_blank" rel="noopener"&gt;2/files/upload_session/finish&lt;/A&gt;. &lt;img class="lia-deferred-image lia-image-emoji" src="https://www.dropboxforum.com/html/@41457EF40051AFF130FDBFE21B496926/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt; In such a way single file upload can get completed using multiple transactions.&lt;/P&gt;&lt;P&gt;The final upload step is time consuming (not only related to upload time) since Dropbox file system have to be locked for new file addition (or any other change). When you have many files, this last step can be optimized by grouping multiple upload sessions in batch and finish their addition to the Dropbox with a single locking using &lt;A title="This route helps you commit many files at once into a user's Dropbox." href="https://www.dropbox.com/developers/documentation/http/documentation#files-upload_session-finish_batch" target="_blank" rel="noopener"&gt;2/files/upload_session/finish_batch_v2&lt;/A&gt;. Single file for every one session passed!&lt;/P&gt;&lt;P&gt;Hope this clarifies matter and you can select a way matching your needs and organize your code better.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Dec 2021 12:47:22 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Upload-session-finish-batch-merges-all-the-files-appended-in/m-p/563084#M26502</guid>
      <dc:creator>Здравко</dc:creator>
      <dc:date>2021-12-08T12:47:22Z</dc:date>
    </item>
  </channel>
</rss>

