0

Im currently trying to create a share links for a pdf file that was just uploaded through my App while using the Dropbox Core API.

The code is below:

request.post('https://api.dropboxapi.com/1/shares/auto/proposals/'+name+'?short_url=false',{
        headers: { Authorization: 'Bearer TOKEN HERE', 'Content-Type': 'application/pdf'
        },body:content}, function optionalCallback (err, httpResponse, bodymsg) {
        if (err) {
            console.log(err);
    }else{
            console.log('Shared link ' + JSON.stringify(httpResponse));
}
});

Points to note:

  1. The PDF file size is 11MB, I can successfully and easily upload the file to dropbox using the API.
  2. The issue only arises when I try to create a share link for the recently uploaded 11MB file.
  3. Also note I am using Node.JS to upload & create share links.

The Error:

The error I get is HTTP Error 413, which based on my research means "Request entity too large"

Below is an image of the error, its not the whole image as the error was too long:

enter image description here

The maximum file size for uploading through the API is 150MB and my file is way below the line. Is there a separate file size for generating share links?

Note

I have tested small files of size 1MB to 2MB and was successfully able to generate a share link, issue arises with large files i.e (11MB)

Skywalker
  • 4,984
  • 16
  • 57
  • 122
  • What's the value of `content`? 413 would suggest you're sending a lot of data to Dropbox, but [`/shares`](https://www.dropbox.com/developers-v1/core/docs#shares) only takes up to two parameters (`locale and `short_url`), and those should both be small. Also, you're sending `application/pdf` as a `Content-Type`, but this method expects a form post. – user94559 Mar 16 '16 at 15:20

1 Answers1

0

Based on the fact that you're sending a body and using a Content-Type of application/pdf, I'm going to guess that you're trying to upload a file with this API call, but that's not what /shares does. /shares is a way to create a shared link to a file that's already in Dropbox. You should upload with, e.g. /files_put, and then call /shares to create a shared link to that file.

user94559
  • 59,196
  • 6
  • 103
  • 103