1
votes

I am new to Box API. I am trying to upload a file, I get bad request.

This is the url I am trying to hit https://upload.box.com/api/2.0/files/content

request body is {"name" : "gg-1.jpg", "parent" : {"id": "0"} } // as I am trying to add file on the root in this call

also header is proper {Authorization: Bearer xxxxx} //xxxxx is some proper refresh token

It throws Bad request error.

Can anyone help me to figure out what's wrong?

1
Can you shown us any of the code you're using to make the request?Sridhar
What does error message say ? Response should contains a more descriptive message.Boris Suvorov
@BorisSuvorov I get only this - The remote server returned an error: (400) Bad Request. Do you see any issue with my request params or the upload url that I am trying to hit?CuriousBenjamin
@Ashish name/parent seems to be sufficient according to documentation. how do you supplying file info (multipart?)? have you tried Curl command as per documentation?Boris Suvorov
developers.box.com/docs/#files-upload-a-file says you have to use a multipart post to do uploadsPeter

1 Answers

0
votes

as Peter suggested, multi-part was the solution.

developers.box.com/docs/#files-upload-a-file