Folders and Deletion
Data containers organize objects into folders. Each data object or folder can exist within one parent folder, and the system prevents circular references. The root folder, identified by the path /, serves as the default location for new objects and cannot be moved, cloned, or removed.
The system treats consecutive / characters as a single / and ignores trailing / characters in folder paths. You can rename, move, and remove folders as needed.
Folder Naming Requirements
Individual folder names have the following requirements:
Must contain between 1 and 2,048 characters in UTF-8 encoding.
Cannot be
.or...Cannot include control characters (matching the regular expression
[\x00-\x1F]).
Complete folder paths have the following requirements:
Must be under 10,240 characters total.
Cannot exceed 128 nested folder levels. That is the root folder
/with up to 128 subfolders.
Deletion of Data
When you remove data objects, the system automatically removes any hidden linked objects that can no longer be reached from other visible objects in the same data container through one or more links. For detailed information about object details, links, and visibility, see Details and Links and Visibility.
You can remove objects in any state. Unless the project has data retention turned on, removal cannot be undone. Removing open objects may cause additional effects, such as making upload URLs invalid. To remove objects, use either the /class-xxxx/removeFolder or /class-xxxx/removeObjects API methods.
Recycle Bin
When a project has data retention turned on, /class-xxxx/removeObjects and /class-xxxx/removeFolder move data objects into the project's recycle bin. Objects in the recycle bin can be recovered until their retention period ends, after which they are permanently deleted. Data retention applies only to projects. Removing objects from containers that are not projects, such as job workspaces, is always permanent.
The project's deletionRetentionEnabled flag, set with /project/new or /project-xxxx/update, turns data retention on, and the billing org's deletionRetentionPeriod and deletionRetentionEnforced org policies set the retention period and whether data retention is enforced.
Each project with data retention turned on has a recycle bin at the reserved path /.recycle_bin. Every deleted object is stored directly in the recycle bin, regardless of the folder it was deleted from. The recycle bin does not appear in /class-xxxx/listFolder output or in the folders field of project describe output. To list its contents, use /project-xxxx/listRecycleBin.
Objects in the recycle bin cannot be described, downloaded, modified, or used as execution inputs, and they do not appear in /system/findDataObjects results. Requests that reference them return ResourceNotFound. Objects in the recycle bin count towards the project's storage until they are permanently deleted.
Recycle Bin Metadata
When an object moves into the recycle bin, the platform records the following metadata on it:
deletedAt- The time the object was deleted.purgeAt- The time after which the object is permanently deleted, calculated from the billing org'sdeletionRetentionPeriodat deletion time. Later changes to the policy do not affect objects already in the recycle bin.previousFolder- The folder the object was deleted from. Recovery restores the object to this folder.
After purgeAt, an object can no longer be recovered, and it no longer appears in /project-xxxx/listRecycleBin output.
Removing Objects with Data Retention
Data retention changes how /class-xxxx/removeObjects and /class-xxxx/removeFolder behave:
Hidden linked objects that the removal orphans move into the recycle bin with the objects that linked to them.
/class-xxxx/removeFolderremoves the folders themselves. Only the data objects they contain move to the recycle bin.A single call can move at most 10,000 objects, counting hidden linked objects.
Objects removed with
overrideProjectAccessalso move to the recycle bin.
Purging a retained object permanently removes that project's link to the object. Other copies in other containers remain unaffected. The underlying file data is permanently deleted from platform storage only when the purged object is the last remaining link. For more information about how data objects and copies share platform data, see Platform IDs and Data Objects in Projects, Data Containers, and Cloning.
To restore objects from the recycle bin, use /project-xxxx/recoverObjects. To purge them before their purgeAt time, use /project-xxxx/purgeRecycleBinObjects.
Operations That Require an Empty Recycle Bin
The following operations fail with InvalidState while the project's recycle bin is not empty:
Changing the project's
billTowith/project-xxxx/update.Transferring the project with
/project-xxxx/transferor/project-xxxx/acceptTransfer.Setting
deletionRetentionEnabledtofalsewith/project-xxxx/update.Destroying the project with
/project-xxxx/destroy.
To run these operations, first recover or purge the recycle bin contents. When the recycle bin holds only objects past their purgeAt time, these operations fail until the system permanently deletes those objects.
Cloning an object into a project whose recycle bin holds a copy of that object also fails with InvalidState. For details, see /class-xxxx/clone.
API Methods
API method: /class-xxxx/newFolder
Specification
Creates a new folder in the data container using the given path.
Inputs
folderstring (required) The new folder to be created in the data container. Must meet the folder naming requirements.parentsboolean (optional) Whether to create the parent folders if they do not exist. Defaults tofalse.
Outputs
idstring ID of the manipulated data container.
Errors
InvalidInputThe input is not a hash.
folderis missing or is not a nonempty string starting with "/".parentsis present but is not a boolean.
ResourceNotFoundThe specified data container does not exist.
parentsis false but the parent folder of the folder specified infolderdoes not yet exist.
InvalidStateA folder with the given path already exists and
parentswas not set to true.folderis/.recycle_binor a path beneath it. This path is reserved for the recycle bin.
PermissionDeniedUPLOAD access is required.
API method: /class-xxxx/renameFolder
Specification
Renames a current folder in the data container with the given name.
Inputs
folderstring (required) Folder to be renamed.namestring (required) The new name of the folder (to replace the string after the last "/" infolder). Must meet the folder naming requirements.
Outputs
idstring ID of the manipulated data container.
Errors
InvalidInputThe input is not a hash.
folderis missing or is not a nonempty string starting with "/".folderis "/".nameis missing or is not a nonempty string with no "/".
ResourceNotFoundThe specified data container does not exist.
The specified folder does not exist.
InvalidStateA folder with the given path already exists.
folderis/.recycle_binor a path beneath it. This path is reserved for the recycle bin.
PermissionDeniedCONTRIBUTE access is required.
API method: /class-xxxx/listFolder
Specification
Lists the contents of a given data container's folder. Only folders or only objects can be specified to be returned, though this method returns both folders and objects by default. This method does not return hidden objects unless includeHidden is set to true.
Inputs
folderstring (optional) The folder to be listed. Defaults to"/".describeboolean or mapping (optional) Controls whether additional metadata is retrieved with data object results. Defaults tofalse. Iftrue, equivalent to passing an empty mapping.If a mapping, represents input used when calling the result's corresponding describe method.
onlystring (optional) Indicates what type of contents to return. Defaults to"all".Must be one of
"folders","objects", or"all".
includeHiddenboolean (optional) Whether to return hidden objects inobjects. Applicable only ifonlyis set to"objects"or"all". Defaults tofalse.hasSubfolderFlagsboolean (optional) Whether to include subfolder flags in the output. Defaults tofalse.
Outputs
objectsarray of mappings List of metadata for all data objects in the specified folder. Each mapping contains:idstring The object ID.describemapping The output of the result's corresponding describe method.Only present when
describewas set in the input.
foldersarray of strings or array of arrays List of all folders directly under the specified folder.If
hasSubfolderFlagsisfalse(default), an array of folder name strings.If
hasSubfolderFlagsistrue, each element is a two-element array containing the folder name (string) and whether it has subfolders (boolean).
Errors
InvalidInputThe input is not a hash.
folderis not a nonempty string starting with "/".onlyis given but is not one of "folders", "objects", and "all".includeHiddenis present but is not a boolean.
ResourceNotFoundThe specified data container does not exist.
A folder with the given path does not exist.
PermissionDeniedVIEW access is required.
API method: /class-xxxx/removeFolder
Specification
Removes the given folder in the data container using the given path. The folder must contain no visible data objects to be removed unless recurse is set to true. Removing the root folder "/" with recurse set to true removes ALL the contents in the data container. Use recurse=true with caution to prevent accidental deletion of data. Removing a folder removes all the visible objects contained in it and all their orphaned hidden links. Any remaining hidden objects that are not removed by this process are placed in the root folder. In particular, if recurse is false and the folder to be removed only contains hidden objects, then these objects are similarly placed in the root folder, and the specified folder folder is removed.
The API call has a limit of 10,000 data objects that can be removed regardless of visibility. If a folder's contents go above this threshold, one can set partial to true to allow for a partial removal of the folder's contents up to this limit. A completed flag in the output indicates whether the folder was fully removed. If completed is false, reissue the API call with the partial flag to continue removing the folder.
When the project has data retention turned on, this method moves the contained data objects into the project's recycle bin and removes the folders.
Inputs
folderstring (required) The folder to be removed from the data container.recurseboolean (optional) Whether to propagate the folder removal to its contained subfolders and objects. Defaults tofalse.forceboolean (optional) Iftrue, this operation does not throw an error even if the given folder does not exist. Defaults tofalse.partialboolean (optional) Iftrue, this operation attempts to remove objects from the folder even if the folder contains more objects than can be deleted at one time. Defaults tofalse.
Outputs
idstring ID of the manipulated data container.completedboolean Whether all objects, subfolders, and the specified folder have been removed. Iffalse, reissue the API call to continue removal.Only present when
partialwas set totrue.
Errors
InvalidInputThe input is not a hash.
folderis missing.folderis not set to a nonempty string starting with "/".folderis set to "/" butrecurseis not specified or is false.recurseis provided and is not a boolean.
ResourceNotFoundThe specified data container does not exist.
A folder with the given path does not exist and
forcewas not set to true.
PermissionDeniedCONTRIBUTE access is required.
InvalidStateThe project contains a DBCluster in a non-terminal state.
recurseis false and the specified folder contains either subfolders or visible objects.partialis false and the specified folder contains more objects than can be deleted in one API call. For more information, see Service Limits.folderis/.recycle_binor a path beneath it. This path is reserved for the recycle bin.The project has data retention turned on, and the folder contains more than 10,000 objects, counting hidden linked objects. To remove the folder, remove its subfolders first.
API method: /class-xxxx/move
Specification
Moves the specified objects or folders into the specified folder. Objects and folders can be moved from any state and any folder in the data container. Objects and folders in a folder listed in folders remain in the (moved) folder unless explicitly listed in objects or folders. In that case, they are removed from their parent folder and moved to the destination folder described in destination. Objects explicitly listed in objects also move any linked hidden objects to the folder indicated as destination.
Inputs
objectsarray of strings (optional) List of data object IDs to be moved.foldersarray of strings (optional) List of folders to be moved.destinationstring (required) The destination folder.
Outputs
idstring ID of the manipulated data container.
Errors
InvalidInputThe input is not a hash.
objects(if provided) is not an array of nonempty strings.folders(if provided) is not an array of nonempty strings starting with "/".Two of the folders in
foldershave the same name but different paths.destinationis missing or is not a nonempty string starting with "/".destinationis/.recycle_binor a path beneath it. Moving objects directly into the recycle bin is not allowed. Use/class-xxxx/removeObjectsor/class-xxxx/removeFolderinstead.
ResourceNotFoundThe specified data container does not exist.
One of the specified objects or folders does not exist in the specified data container.
The destination folder does not exist.
PermissionDeniedCONTRIBUTE access is required.
InvalidStateA folder listed in
foldersis or contains the destination folder.A folder listed in
foldersis/.recycle_binor a path beneath it. To restore objects from the recycle bin, use/project-xxxx/recoverObjects.
API method: /class-xxxx/removeObjects
Specification
Removes the specified objects from the data container. When you remove objects, the system also removes any hidden linked objects that can no longer be reached from other visible objects in the same data container through one or more links. You can remove objects in any state. Unless the project has data retention turned on, removal cannot be undone.
Removing open objects may cause additional effects, such as making upload URLs invalid. To restore a removed object to the data container, you must have a copy in another data container and the proper permissions to clone it back. When cloning an object back, any previously set custom metadata is lost and replaced with metadata from the source data container. For more information, see Cloning.
When the project has data retention turned on, this method moves the objects into the project's recycle bin. To restore them before their retention period ends, use /project-xxxx/recoverObjects.
Inputs
objectsarray of strings (required) List of object IDs to be removed from the data container.forceboolean (optional) Iftrue, this operation does not throw an error even if the given object does not exist. Defaults tofalse.overrideProjectAccessboolean (optional) Iftrue, removes objects from any project or container billed to an organization for which the requesting user has thedataDeletionpermission, regardless of project or container membership. Defaults tofalse.
Outputs
idstring ID of the manipulated data container.
Errors
InvalidInputThe input is not a hash.
objectsis missing or is not an array of nonempty strings.
ResourceNotFoundThe specified data container does not exist.
An object with the given ID does not exist or does not exist in the specified data container and
forcewas not set totrue.
PermissionDeniedCONTRIBUTE or ADMINISTER access is required, depending on the PROTECTED flag.
overrideProjectAccessistruebut the requesting user does not have thedataDeletionpermission for an organization that bills the data container.
InvalidStateOne of the objects is a DBCluster in a non-terminal state.
The project has data retention turned on, and the request covers more than 10,000 objects, counting hidden linked objects. To remove them, split the request into smaller batches.
Last updated
Was this helpful?