405 Error On File Upload API Call
I'm migrating files from box view version 1 to the new api. That means I'm iterating over all my files and uploading them to the new api. I am able to successfully upload a lot of files but then on some files I get a 405 Method Not Allowed Error. The files that succeed use the exact same code/API token as the ones that are failing. Here's some more info:
I'm doing a POST to https://upload.box.com/api/2.0/files/content. It's a multipart body request. The first part of the body are the attributes:
{"name":"name_of_file", "parent":{"id":"0"}}
The second part of the body is the file itself.
-
Hi , thanks for writing to our forums! I'm excited to hear you're moving over to our New View API!
Since most of your files are working, what you're seeing is probably a little more transient. If you simply retry those files again, do the issues persist or go away?
I'm inclined to say what you're seeing is not expected. If it's not too much trouble, could you please open up a support ticket with us (use Contact Support in the top menu bar of this page)? We'll want to collect some more specific details about your application (maybe not appropriate for this forum) to see exactly what's going on.
Thanks!
Jason
-
Hey and ,
While working on a support case for one of our enterprise customers, we discovered a possible root cause for this issue (by accident). It's possible that the content type you are sending is not multipart/form-data. Instead, we've seen that an application/x-www-form-urlencoded content-type will reproduce this 405 error.
You can verify whether your application is sending the correct content-type by making your API call to https://httpbin.org/anything instead of api.box.com, which will echo the details of your API call. Even if it's not the content-type error, you could compare your code's API call with a successful call via Postman to see what the difference might be.
Hope that helps!
Thanks,
Jason
Please sign in to leave a comment.
Comments
5 comments