Trashbin API
Introduction
The trash bin API provides support for managing files in ownCloud’s trash bin. Specifically, it provides the following functionality:
List Files
List all files in the trash bin
-
Path:
remote.php/dav/trash-bin/<username> -
Method:
PROPFIND
Request Parameters
| Attribute | Type | Description |
|---|---|---|
|
string |
The username of the user to list files for. |
Request Headers
| Header | Type | Description | ||
|---|---|---|---|---|
|
int |
The maximum level to descend to, when retrieving a listing of the files in the user’s trash bin.
|
Delete Files
Restore Deleted File
Restore a file from the trash bin.
-
Path:
remote.php/dav/trash-bin/<username>/<fileid> -
Method:
MOVE
Request Parameters
| Attribute | Type | Description |
|---|---|---|
|
string |
The username of the user to list files for. |
|
integer |
The id of the file to delete. |
Request Headers
| Header | Type | Value | Description |
|---|---|---|---|
|
string |
|
Whether to overwrite an existing file. |
|
string |
|
The path where the file will be restored to. |
Returns
Success
If Overwrite is set to F and a file with the same name in the specified location does not exist, or if Overwrite is set to T, an HTTP 204 (No Content) status code will be returned, if the resource is successfully restored.
File Already Exists
If the Overwrite header is set to F and a file exists with the same name as specified in the Destination string, then an HTTP 412 (Precondition Failed) status code is returned, along with the following XML response:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\PreconditionFailed</s:exception>
<s:message>The destination node already exists, and the overwrite header is set to false</s:message>
<s:header>Overwrite</s:header>
</d:error>
Incorrect Overwrite Header
If the Overwrite header is not set to either T or F, then an HTTP 400 (Bad Request) status code will be returned, along with the following XML response:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\BadRequest</s:exception>
<s:message>The HTTP Overwrite header should be either T or F</s:message>
</d:error>
Destination Directory Does Not Exist
If the destination directory does not exist, then an HTTP 409 (Conflict) status code will be returned, along with the following XML response:
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\Conflict</s:exception>
<s:message>The destination node is not found</s:message>
</d:error>