When making uploads to Box via the Upload file API endpoint, a 405 Method Not Allowed status code is returned and your upload fails.
Environment
Any application making API calls to upload files to Box. Since the root cause is due to a formatting error within the API call, this error occurs most commonly with custom built API calls, outside of any official Box SDK.
Steps To Resolve
Inspect your outgoing API call and verify that it matches the parameters specified in the Upload File API endpoint namely, the content-type parameter and the HTTP method used.
A few suggestions for doing this:
- Inspect your Upload file API call and ensure you are explicitly using the correct content-type parameter and the POST HTTP method. You can use a tool such as Fiddler, RequestBin, etc. to inspect your Upload File API call.
- Test the Upload File API endpoint to ensure you're able to upload a file successfully using an application such as Postman, Insomnia, etc.
- Compare the known good API call request parameters against the API call request parameters used in your application, script, or code
- Fix the differences to match the known good API call request
Root Cause
The most common reason for this error is that the content-type parameter or the HTTP method used does not match API call parameters or method specified in the Upload File API endpoint. The content-type parameter must explicitly be multipart/form-data and the only supported HTTP method for the Upload File API call is POST.