Error:"Invalid value 'd_xxxxxxxxxx2'" while using Box config file

SOLVED
Go to solution
Highlighted
First-time Contributor

Error:"Invalid value 'd_xxxxxxxxxx2'" while using Box config file

Hi All
I am facing an issue only when using Box config file.

It is failing exactly on the line highlighted in below code snippet.

I am passing "xxxxxxxxxx2" as my parent folder Id. But in the exception message it seems to be appending "d_" before the parent folder Id.
Whereas, I can see no issue when using Developer Token for the same task.
Exception:

The API returned an error code: 404
{"type":"error","status":404,"code":"not_found","context_info":{"errors":[{"reason":"invalid_parameter","name":"folder","message":"Invalid value 'd_xxxxxxxxxx2'. 'folder' with value 'd_xxxxxxxxxx2' not found"}]},"help_url":"http:\/\/developers.box.com\/docs\/#errors","message":"Not Found","request_id":"ejhgfyugchbakus6"}

Code snippet:

Reader reader = new FileReader("src/main/resources/xxxxxxxx_xxxxx_config.json");
BoxConfig boxConfig = BoxConfig.readFrom(reader);
IAccessTokenCache accessTokenCache = new InMemoryLRUAccessTokenCache(100);
BoxDeveloperEditionAPIConnection bac = BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig, accessTokenCache);

BoxFolder bfolder = new BoxFolder(bac, "xxxxxxxxxx2");
for (BoxItem.Info itemInfo : bfolder) {
if (itemInfo instanceof BoxFolder.Info) {
BoxFolder.Info folderInfo = (BoxFolder.Info) itemInfo;
if(folderInfo.getName().toString().compareTo("Folder1")==0)
{
info = folderInfo;
}
}
}

2 REPLIES 2
Highlighted
Box Employee

Re: Error:"Invalid value 'd_xxxxxxxxxx2'" while using Box config file

@Biswa_Dutta:

 

This usually indicates that the token you're using does not own or have collaborator access to the folder ID you're passing in. 

 

Best, 

Kourtney

Box Technical Support Engineer

Highlighted
First-time Contributor

Re: Error:"Invalid value 'd_xxxxxxxxxx2'" while using Box config file

Hi, I am having the same error with the following additional details:

I created a folder (I assume the ownership is tied to my User Account)

I can't access perform uploads/downloads to this folder with my App (Service Account).

 

I have authorised my app to 'Act as User'

My app is also authorised to read and write.

 

What other steps am I missing to deal with this issue of 'collaborator/access'?

Appreciate your help on this. 

Thanks!