Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

File Upload Issues using API

Answered
New post

Comments

3 comments

  • Murtza

     You might be seeing this error because you are setting the value of parent object id as an int instead of a string. Can you please retry the request by changing the parent object id type as shown below?

     

    Change This Line:

    var newFile = new { name = "test.txt", parent = new { id = 234} } ;

    To:

    var newFile = new { name = "test.txt", parent = new { id = "234"} } ;

    0
    Comment actions Permalink
  • sids

    Murtza - I changed the Id type to string, that did not solve the issue. 

    0
    Comment actions Permalink
  • sids

    I found the solution, the Upload endpoint expects parent_id not the parent object as mentioned in the documentation (that's how I was able to upload the file using .NET HttpClient).

     

    content.Add(new StringContent({fileId}), "parent_id"); 

     

    Thank you for your prompt support.

     

    Sid

    0
    Comment actions Permalink

Please sign in to leave a comment.