Skip to main content

Box API 404 error sometimes

  • July 14, 2023
  • 1 reply
  • 260 views

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 [404 | 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()

1 reply

smartoneinok Box
Forum|alt.badge.img
  • Senior Developer Advocate
  • 181 replies
  • September 15, 2023

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 🥑


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings