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

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.