Skip to main content

I am having some issues with an Apache Groovy script. When users run this script it sometimes returns this error - it fails at the line def subFolder = parentFolder.createFolder(subFolderName).getResource()



BoxAPIResponseException: The API returned an error code [404 | m75vwdhfthirxg8m.0155c36fdf223f6693c60b71343f0bfc6] not_found - Not Found



Exception chain:


ScriptException: com.box.sdk.BoxAPIResponseException: The API returned an error code [404 | m75vwdhfthirxg8m.0155c36fdf223f6693c60b71343f0bfc6] not_found - Not Found


…caused by: BoxAPIResponseException: The API returned an error code e404 | m75vwdhfthirxg8m.0155c36fdf223f6693c60b71343f0bfc6] not_found - Not Found



Some users have found clearing their cache allows them to then run this script


The box folder has AutomationUser_1282163_2jhq1tTUma@boxdevedition.com as an Editor


The file names are unique names and do not contain illegal characters


The parent folder exists



Here is the relevant code


import com.box.sdk.BoxFolder



def today = new Date();


def fileName = "Priority " + priority + " - Purchase Order Request - " + email.split(‘@’)0] + " - " + supplier + " - " + today + " - " + po_key + “.txt”;


def folderId = “123”



def subFolderName = fileName


def parentFolder = new BoxFolder(Box.getClient(), folderId)


def subFolder = parentFolder.createFolder(subFolderName).getResource()


subFolderId = subFolder.getID()

Hello, 👋



The not found error typically occurs when the user making the API call doesn’t have access to the underlying folder. Is the folder ID always the same for the parent folder or does it change each time the script runs?



Thanks,


Alex. Box Developer Advocate 🥑


Reply