When making uploads to Box via the API, 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 call, namely, the content-type.
A few suggestions for doing this:
- Use your own method to inspect your outgoing API call (e.g. Fiddler)
- Use Postman to send a successful API call with known good parameters to Box. Then, change the endpoint to an online service which echoes the request (e.g. requestb.in).
- Compare the known good echoed request with an echoed trouble request sent from your code.
- Fix the differences to match the known good echoed request.
Root Cause
The most common reason for this error is that the content-type does not match the format/value specified in the Upload File API call at https://developer.box.com/reference. However, other mismatches are possible and would cause this error message.