Suddenly getting 405 Method Not Allowed during POST to create folder in box-api Suddenly getting 405 Method Not Allowed during POST to create folder in box-api curl curl

Suddenly getting 405 Method Not Allowed during POST to create folder in box-api


The Bearer header i.e.

Authorization: Bearer {a bearer token acquired through oauth2}

will only work with bearer tokens retrieved through the OAuth 2 process. This header will not work with auth tokens retrieved through the V1 Auth process. You'll need to use the old header style with V1 auth tokens i.e.

Authorization: BoxAuth api_key={your api key}&auth_token={your v1 auth token}


The Create a New Folder method has changed just a bit; this is indicated in the cURL example you've included. Now you must not include the parent folder ID at the end of the request URL, and you must include the parent folder ID in the request body:

String response = Request.Post(newStringBuilder(API_BASE_URL).append("/folders").toString().addHeader("Authorization", API_REQUEST_HEADER).bodyString(new StringBuilder("{\"name\":\"").append(name).append("\", \"parent\": {\"id\": \"").append(parent_folder_id).append("\"}}").toString(), ContentType.DEFAULT_TEXT).execute().handleResponse(myResponseHandler);

EDIT: While I think the method signature change will address your immediate problem, seanrose is spot on in pointing out that you'll need to transition to OAuth2 for long-term stability.