http://yourserver.com/services/remove ?q=<query> &ids=<comma-delimited asset ids> &folderPath=<folder to remove> &async=<true | false>
What does it do?
Removes one or more assets, or folders including their content.
Log in requirement
Before being able to request information from Assets Server by using a GET request or make changes to the system through a POST request, a log in to Assets Server is required. For information about the available APIs for logging in, see Assets Server REST API - introduction.
POST requests only
This REST API only accepts POST requests, not GET requests. Also, the POST request needs to include a cross-site request forgery (csrf) token.
The csrf token is a unique code which, by including it in the request, also makes the POST request unique and therefore much more secure.
The csrf token is obtained by first logging in to Assets Server through a POST request. The response that is received will include the csrf token which can then be used in subsequent POST requests as a http header:
For more information including examples, see Assets Server REST API - Performing a POST request with a csrf token.
|q||A query that matches all assets to be removed. Be careful with this and make sure you test your query using a search call to prevent removing assets that you did not want to be removed.|
A comma-delimited list of asset ids to be removed.
The folderPath of the folder to remove. The last folder in the argument is removed, along with all subfolders and all assets.
When true, the process will run asynchronous in the background. The call will return immediate with the processId.
Optional. By default, the call waits for the process to finish and then returns the processedCount.
Note: It is not possible to combine the ids , q and folderPath parameters. When multiple parameters are provided, only one is used in the following priority:
The operation returns a JSON object with the following properties:
|processedCount||Number of assets that were processed by the operation.|
|errorCount||Number of errors that occurred.|
If called with async=true, the operation returns a JSON object with the following properties:
|processId||Unique id of the process that was started.|
If the operation fails, a JSON error object is returned.
Remove by ids
Remove by query
The following removes all assets imported more than one year ago.
http://demo.assets-server.com/services/remove ?q=assetCreated:[* TO NOW-1YEAR]
Remove a complete folder
The following removes a complete folder, including subfolders and all contained assets.
http://demo.assets-server.com/services/remove ?folderPath=/Demo Zone/Images
- 15 August 2022: Updated the description to better indicate that folders can be removed too.
- 15 August 2022: Updated the folderPath parameter to better describe what is removed.
- 15 August 2022: Updated the 'Parameters' section by better explaining the priority in which parameters are used when multiple parameters are provided.