Delete a Folder or File - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

Deleting a node, such as a folder or file, is easy. Here is how to do it.

API Explorer URL: http://localhost:8080/api-explorer/#!/nodes/deleteNode

See also: Restore Deleted Folders and Files (Trashcan)

There comes a point when you want to remove a folder or file from the Repository. This can be done with the following HTTP DELETE call: http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/{id}

The Node Identifier for the folder or file node to be deleted is specified with the {id} parameter.

The following call will delete the text file identified with the d8f561cc-e208-4c63-a316-1ea3d3a4e10e Node Identifier:

$ curl -X DELETE -H 'Accept: application/json' -H 'Authorization: Basic VElDS0VUXzA4ZWI3ZTJlMmMxNzk2NGNhNTFmMGYzMzE4NmNjMmZjOWQ1NmQ1OTM=' 'http://localhost:8080/alfresco/api/-default-/public/alfresco/versions/1/nodes/d8f561cc-e208-4c63-a316-1ea3d3a4e10e'  
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:-*   0

This doesn’t actually delete the node permanently, but instead it ends up in what’s referred to as the Trashcan. So it’s only soft deleted and can be restored if needed. If you want the file to be permanently deleted, then you can append a parameter called permanent and set it to true. This only works if you are the owner of the file or an administrator.