I’ve been trying calling the upload API for box in node.js application and keep getting 415 Unsupported_Media_Type. I gave the correct parent id. Also tried using both parent_id and parent: { ‘id’: ‘12345’}
response.status = 415
response.statusText = Unsupported Media Type
I also tried "Try this API’ on the developers page and just get ‘An unknown error occured’. When tried to get more details from the browser developer tools then I see that the call just returned as above 415 and unsupported media type message.
If I include 'Content-type" header with multipart/form-data then it doesn’t find the file part.
What is the wrong with the following code?
PS: I do not want to use SDK.
var parent = ‘12345’;
var token = 'Bearer ’ + accessToken;
Because the node SDK is still using the deprecated request module and it has a vulnerability now. The github there is already an issue which is 3 years old and still not being fixed.
The best way I see now is to see in using API route. I got the authentication part taken care of - just the error messages doesn’t help much now
I’m not sure if you’ve already tried this… but our Postman collection might help here. You can open any of the endpoints. Then, on the right side, click the code button and select a language. It will write out the appropriate code for you.
Yes, I tried that route just in case if the code above mentioned is wrong. When I took the Postman generated code then also I get the same error. I also tried to send a string instead of actual file stream then I get 400 Bad request.
I even went the route of debugging the box-node-sdk to see what it does behind the scene and use the code without any success. Something is not right, for sure. But what it is