Welcome to the new Box Support website. Check out all the details here on what’s changed.

Create upload session get error HTTP 415

New post

Comments

5 comments

  • Masa Jow

    What is the folder_id, file_size, and file_name?

    0
    Comment actions Permalink
  • Sandra Ribouchon

    Hi,

    For the folder_id I used 0, like in the documentation (https://developer.box.com/reference/post-files-upload-sessions/) to send to the root of my Box, the file_size is my file size (133153433) and file_name my file name (test.tar.gz).

     

    Thank you

    0
    Comment actions Permalink
  • Masa Jow

    I found some post where the lack of extension would cause the 415 error, but that's not the case for you.

    I'm actually getting that error too. I happen to be using golang, although it works on the curl command line following their example.

    0
    Comment actions Permalink
  • Sandra Ribouchon

    Hi,

    Does anyone has an idea, please?

    Thank you

    0
    Comment actions Permalink
  • Sandra Ribouchon

    In case someone else have this issue, here is what I changed on my curl:

    CURLOPT_HTTPHEADER => array('Authorization: Bearer '.$token, 'Content-Type: application/json'),
    CURLOPT_URL => 'https://upload.box.com/api/2.0/files/upload_sessions',
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => '{
    "folder_id": "'.$id_file_destination.'",
    "file_size": '.$total_file_size.',
    "file_name": "'.$name.'"
    }',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_SSL_VERIFYHOST => 2,
    CURLOPT_SSL_VERIFYPEER => true,
    CURLOPT_CAINFO => 'cacert.pem'

    No slash at the end of the url and no comma after the file name.

    1
    Comment actions Permalink

Please sign in to leave a comment.