403 Error Attempting to Change Folder Name
AnsweredMy client setup an account as a co-owner on a Box parent folder where we are creating folders and copying files via the Box API. We are using the authorization token for that account to connect to Box. With that account, I can create folders and copy files to it using the API, but I cannot rename or delete a folder that I created with the same account. I get this error:
{StatusCode: 403, ReasonPhrase: 'Forbidden', Version: 1.1, Content: System.Net.Http.HttpConnectionResponseContent, Headers:
{
Date: Wed, 16 Jun 2021 12:20:55 GMT
Transfer-Encoding: chunked
Connection: keep-alive
Strict-Transport-Security: max-age=31536000
WWW-Authenticate: Bearer realm="Service", error="insufficient_scope", error_description="The request requires higher privileges than provided by the access token."
BOX-REQUEST-ID: 09b94dcb0b04b74b12e25bd62c84572a6
}}
Here's the Service URL use in the code below: https://api.box.com/2.0/folders/139188030416
Here's the code used to attempt to rename the folder:
using (HttpClient client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
//set authorization header based on received bearer token
client.DefaultRequestHeaders.Add("authorization", $"Bearer {authorizationToken}");
var dataContent = "{\"name\": \"" + newFolderName + "\"}";
var content = new StringContent(dataContent, Encoding.UTF8, "application/json");
HttpResponseMessage response = client.PostAsync($"{serviceURL}" + folderId.ToString(), content).Result;
if (response.IsSuccessStatusCode)
return new ResultData("Success", new Dictionary<string, object> { { "Result", response.Content.ReadAsStringAsync().Result } });
else
return new ResultData("Error", new Dictionary<string, object> { { "Result", response.Content.ReadAsStringAsync().Result } });
}
In speaking with the client they are saying that they do not see any options that they can change that would change the behavior.
Any help would be appreciated.
Jacob
Please sign in to leave a comment.
Comments
4 comments