Java SDK - Upload file returns 404 error code
I created an application with oAuth 2.0 JWT security. I have generated the keys and applied the JSON configuration:
// Read config file into Box Config object
Reader reader = new FileReader("C:\\Users\\mulesoftu\\project\\src\\126855135_zrvkcx47_config.json");
BoxConfig boxConfig = BoxConfig.readFrom(reader);
// Set cache info
int MAX_CACHE_ENTRIES = 100;
IAccessTokenCache accessTokenCache = new
InMemoryLRUAccessTokenCache(MAX_CACHE_ENTRIES);
// Create new app enterprise connection object
BoxDeveloperEditionAPIConnection client =
BoxDeveloperEditionAPIConnection.getAppEnterpriseConnection(boxConfig, accessTokenCache);
// PERFORM ACTIONS WITH CLIENT
BoxFolder folder = new BoxFolder(client, FOLDER_ID);
FileInputStream stream;
try {
stream = new FileInputStream("C:\\Users\\mulesoftu\\Desktop\\sample.json");
BoxFile.Info newFileInfo = folder.uploadFile(stream, "sample.json");
stream.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Authentication works but when I upload the file I get the following error:
com.box.sdk.BoxAPIResponseException: The API returned an error code [404 | lgvfitg2cndk661x] not_found - Not Found
I have tried to use checking "Perform Actions as Users" and reauthorize the app from Admin Console but the result is the same error.
Any idea?
Please sign in to leave a comment.
Comments
1 comment