Search documentation
karat

+

K

User Documentation ↗
Version 2.0

Delete File

DELETE/api/v2/datasets/{datasetRid}/files/{filePath}

Deletes a File from a Dataset. By default the file is deleted in a new transaction on the default branch - master for most enrollments. The file will still be visible on historical views.

Advanced Usage

See Datasets Core Concepts for details on using branches and transactions. To delete a File from a specific Branch specify the Branch's name as branchName. A new delete Transaction will be created and committed on this branch. To delete a File using a manually opened Transaction, specify the Transaction's resource identifier as transactionRid. The transaction must be of type DELETE. This is useful for deleting multiple files in a single transaction. See createTransaction to open a transaction.

Third-party applications using this endpoint via OAuth2 must request the following operation scope: api:datasets-write.

Path parameters

datasetRid
string

The Resource Identifier (RID) of a Dataset.

filePath
string

The path to a File within Foundry. Examples: my-file.txt, path/to/my-file.jpg, dataframe.snappy.parquet.

Query parameters

branchName
string
optional

The name of the Branch on which to delete the File. Defaults to master for most enrollments.

transactionRid
string
optional

The Resource Identifier (RID) of the open delete Transaction on which to delete the File.

Examples

Request

Copied!
1 2 3 curl -X DELETE \ -H "Authorization: Bearer $TOKEN" \ "https://$HOSTNAME/api/v2/datasets/ri.foundry.main.dataset.c26f11c8-cdb3-4f44-9f5d-9816ea1c82da/files/My Folder/my-file.csv?branchName=master&transactionRid=ri.foundry.main.transaction.0a0207cb-26b7-415b-bc80-66a3aa3933f4"

Error responses

Error Name
BranchNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe requested branch could not be found, or the client token does not have access to it.
ParametersdatasetRid, branchName
FileNotFoundOnBranchError CodeNOT_FOUND
Status Code404
DescriptionThe requested file could not be found on the given branch, or the client token does not have access to it.
ParametersdatasetRid, branchName, path
OpenTransactionAlreadyExistsError CodeCONFLICT
Status Code409
DescriptionA transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time.
ParametersdatasetRid, branchName
InvalidParameterCombinationError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe given parameters are individually valid but cannot be used in the given combination.
ParametersvalidCombinations, providedParameters
DatasetNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe requested dataset could not be found, or the client token does not have access to it.
ParametersdatasetRid
TransactionNotFoundError CodeNOT_FOUND
Status Code404
DescriptionThe requested transaction could not be found on the dataset, or the client token does not have access to it.
ParametersdatasetRid, transactionRid
FileNotFoundOnTransactionRangeError CodeNOT_FOUND
Status Code404
DescriptionThe requested file could not be found on the given transaction range, or the client token does not have access to it.
ParametersdatasetRid, startTransactionRid, endTransactionRid, path
InvalidTransactionTypeError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe given transaction type is not valid. Valid transaction types are `SNAPSHOT`, `UPDATE`, `APPEND`, and `DELETE`.
ParametersdatasetRid, transactionRid, transactionType
TransactionNotOpenError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe given transaction is not open.
ParametersdatasetRid, transactionRid, transactionStatus
OpenTransactionAlreadyExistsError CodeCONFLICT
Status Code409
DescriptionA transaction is already open on this dataset and branch. A branch of a dataset can only have one open transaction at a time.
ParametersdatasetRid, branchName
CreateTransactionPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionThe provided token does not have permission to create a transaction on this dataset.
ParametersdatasetRid, branchName
AbortTransactionPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionThe provided token does not have permission to abort the given transaction on the given dataset.
ParametersdatasetRid, transactionRid
CommitTransactionPermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionThe provided token does not have permission to commit the given transaction on the given dataset.
ParametersdatasetRid, transactionRid
InvalidBranchNameError CodeINVALID_ARGUMENT
Status Code400
DescriptionThe requested branch name cannot be used. Branch names cannot be empty and must not look like RIDs or UUIDs.
ParametersbranchName
DeleteFilePermissionDeniedError CodePERMISSION_DENIED
Status Code403
DescriptionCould not delete the File.
ParametersdatasetRid, filePath