<?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 filesUploadSessionFinishBatchV2: Response failed with a 413 code in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/filesUploadSessionFinishBatchV2-Response-failed-with-a-413-code/m-p/617034#M28429</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to upload 10~20 image files at once to Dropbox professional account with Javascript SDK.&lt;/P&gt;&lt;P&gt;Each image is less than 15MB.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to DBX Performance guide, I tried to upload 1 image with batch function like below.&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;file1 = "./public/demo/1.png";
file2 = "./public/demo/2.jpg";

data1 = fs.readFileSync(file1);
data2 = fs.readFileSync(file2);

tpath1 = "/demo/data12.png";
tpath2 = "/demo/data2.jpg";

function startBatch() {   
  return new Promise(resolve=&amp;gt; {
    r = dbx.filesUploadSessionStartBatch({
      num_sessions: 1
    });
    resolve(r);
  });
}

function upload(sid) {
  return new Promise(resolve=&amp;gt; {
       // r = dbx.filesUploadSessionStart({ close: true, contents: data1})
       console.log("upload func:"+sid);


    r = dbx.filesUploadSessionAppendV2({
      contents: data1,
      cursor: {
        contents: data1,
        session_id: sid[0],
        offset: data1.length 
      },
      close: true
    });
    resolve(r);
  });  
}

(async ()=&amp;gt;{
  r = await startBatch();  
  sid = r.result.session_ids;
  console.log(sid);

  (async ()=&amp;gt;{
    r1 = await upload(sid);
    console.log(r1);
  })();

  dbx.filesUploadSessionFinishBatchV2({
    entries: [{
      cursor: {
        session_id: sid[0],
        offset: data1.length,
        contents: data1 
      },
      commit: {
        path: tpath1, 
        mode: true, 
        autorename: true,
        mute: false, 
        strict_conflict: true
      }
    }]
  })

})();&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;When the program runs at &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;filesUploadSessionFinishBatchV2, it show me 'DropboxResponseError: Response failed with a 413 code' like below&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.jpg" style="width: 800px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/31162i74C4480FCB8DECE4/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.jpg" alt="error.jpg" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to find out what the solution is, so far I don't get one.&lt;/P&gt;&lt;P&gt;Please note that I'm new to Javscript and ES6 : (&lt;/P&gt;&lt;P&gt;If you show me a code, that would be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to upload 20 image files it without any error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me out please.&lt;/P&gt;</description>
    <pubDate>Fri, 19 Aug 2022 08:52:11 GMT</pubDate>
    <dc:creator>Tigerseo</dc:creator>
    <dc:date>2022-08-19T08:52:11Z</dc:date>
    <item>
      <title>filesUploadSessionFinishBatchV2: Response failed with a 413 code</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/filesUploadSessionFinishBatchV2-Response-failed-with-a-413-code/m-p/617034#M28429</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to upload 10~20 image files at once to Dropbox professional account with Javascript SDK.&lt;/P&gt;&lt;P&gt;Each image is less than 15MB.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;According to DBX Performance guide, I tried to upload 1 image with batch function like below.&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;file1 = "./public/demo/1.png";
file2 = "./public/demo/2.jpg";

data1 = fs.readFileSync(file1);
data2 = fs.readFileSync(file2);

tpath1 = "/demo/data12.png";
tpath2 = "/demo/data2.jpg";

function startBatch() {   
  return new Promise(resolve=&amp;gt; {
    r = dbx.filesUploadSessionStartBatch({
      num_sessions: 1
    });
    resolve(r);
  });
}

function upload(sid) {
  return new Promise(resolve=&amp;gt; {
       // r = dbx.filesUploadSessionStart({ close: true, contents: data1})
       console.log("upload func:"+sid);


    r = dbx.filesUploadSessionAppendV2({
      contents: data1,
      cursor: {
        contents: data1,
        session_id: sid[0],
        offset: data1.length 
      },
      close: true
    });
    resolve(r);
  });  
}

(async ()=&amp;gt;{
  r = await startBatch();  
  sid = r.result.session_ids;
  console.log(sid);

  (async ()=&amp;gt;{
    r1 = await upload(sid);
    console.log(r1);
  })();

  dbx.filesUploadSessionFinishBatchV2({
    entries: [{
      cursor: {
        session_id: sid[0],
        offset: data1.length,
        contents: data1 
      },
      commit: {
        path: tpath1, 
        mode: true, 
        autorename: true,
        mute: false, 
        strict_conflict: true
      }
    }]
  })

})();&lt;/LI-CODE&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;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;SPAN&gt;When the program runs at &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;filesUploadSessionFinishBatchV2, it show me 'DropboxResponseError: Response failed with a 413 code' like below&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="error.jpg" style="width: 800px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/31162i74C4480FCB8DECE4/image-size/large?v=v2&amp;amp;px=999" role="button" title="error.jpg" alt="error.jpg" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried to find out what the solution is, so far I don't get one.&lt;/P&gt;&lt;P&gt;Please note that I'm new to Javscript and ES6 : (&lt;/P&gt;&lt;P&gt;If you show me a code, that would be helpful.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just want to upload 20 image files it without any error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Help me out please.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 08:52:11 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/filesUploadSessionFinishBatchV2-Response-failed-with-a-413-code/m-p/617034#M28429</guid>
      <dc:creator>Tigerseo</dc:creator>
      <dc:date>2022-08-19T08:52:11Z</dc:date>
    </item>
    <item>
      <title>Re: filesUploadSessionFinishBatchV2: Response failed with a 413 code</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/filesUploadSessionFinishBatchV2-Response-failed-with-a-413-code/m-p/617067#M28430</link>
      <description>&lt;P&gt;A 413 error indicates that the request failed because the payload was too large.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The filesUploadSessionFinishBatchV2 method in particular is a way to finish multiple upload sessions at once, and does not itself accept file data. That being the case, don't set 'contents' when calling filesUploadSessionFinishBatchV2.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2022 13:04:26 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/filesUploadSessionFinishBatchV2-Response-failed-with-a-413-code/m-p/617067#M28430</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-08-19T13:04:26Z</dc:date>
    </item>
  </channel>
</rss>

