Skip to content

Commit 843613e

Browse files
cekkdavisagli
andauthored
[recycle bin] improve rest endpoints and test with real tool (#2005)
* improve rest endpoints and test with real tool * some fixes * Update test responses * Make deletion date stable in test responses --------- Co-authored-by: David Glick <david@glicksoftware.com>
1 parent bd1fc09 commit 843613e

21 files changed

Lines changed: 958 additions & 981 deletions

docs/source/endpoints/recycle-bin.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,29 +30,23 @@ A list of all items in the recycle bin can be retrieved by sending a `GET` reque
3030

3131
The listing supports various query parameters for filtering and sorting:
3232

33-
- `search_query`: Search in title and path (case-insensitive)
34-
- `filter_type`: Filter by content type (e.g., "Document", "Folder")
35-
- `date_from`: Filter by deletion date from (YYYY-MM-DD format)
36-
- `date_to`: Filter by deletion date to (YYYY-MM-DD format)
37-
- `filter_deleted_by`: Filter by user who deleted the item
38-
- `filter_has_subitems`: Filter items with/without children (`with_subitems`, `without_subitems`)
39-
- `filter_language`: Filter by language code
40-
- `filter_workflow_state`: Filter by workflow state
41-
- `sort_by`: Sorting options:
42-
- `date_desc` (default) - Most recent first
43-
- `date_asc` - Oldest first
44-
- `title_asc` / `title_desc` - Alphabetical by title
45-
- `type_asc` / `type_desc` - By content type
46-
- `path_asc` / `path_desc` - By path
47-
- `size_asc` / `size_desc` - By size
48-
- `workflow_asc` / `workflow_desc` - By workflow state
33+
| Parameter | Description | Example |
34+
|-----------|-------------|---------|
35+
| `title` | Filter by title (case-insensitive substring match) | `title=my doc` |
36+
| `path` | Filter by path (case-insensitive substring match) | `path=/plone/news` |
37+
| `portal_type` | Filter by content type | `portal_type=Document` |
38+
| `date_from` | Filter by deletion date from (YYYY-MM-DD) | `date_from=2024-01-01` |
39+
| `date_to` | Filter by deletion date to (YYYY-MM-DD) | `date_to=2024-12-31` |
40+
| `deleted_by` | Filter by the user ID who deleted the item | `deleted_by=admin` |
41+
| `has_subitems` | Filter items with (`true`) or without (`false`) children | `has_subitems=true` |
42+
| `language` | Filter by language code | `language=it` |
43+
| `review_state` | Filter by workflow state | `review_state=published` |
44+
| `sort_on` | Sort field: `title`, `portal_type`, `path`, `deletion_date`, `review_state` | `sort_on=title` |
45+
| `sort_order` | Sort direction: `ascending` or `descending` (default) | `sort_order=ascending` |
4946

5047
### Batching
5148

52-
The API supports standard Plone REST API batching parameters:
53-
54-
- `b_start`: Starting position for batch
55-
- `b_size`: Number of items per batch
49+
The API supports standard Plone REST API batching parameters (`b_start`, `b_size`).
5650

5751
#### Example with filtering and sorting
5852

@@ -67,7 +61,8 @@ The API supports standard Plone REST API batching parameters:
6761

6862
## Get individual item from recycle bin
6963

70-
To retrieve detailed information about a specific item in the recycle bin, send a GET request to `@recyclebin/{item_id}`:
64+
To retrieve detailed information about a specific item in the recycle bin, including its sub-items, send a `GET` request to `@recyclebin/{item_id}`.
65+
The response includes a paginated `items` list with all flattened descendants. Standard batching parameters (`b_start`, `b_size`) are supported.
7166

7267
```{eval-rst}
7368
.. http:example:: curl httpie python-requests
@@ -80,7 +75,7 @@ To retrieve detailed information about a specific item in the recycle bin, send
8075

8176
## Restore an item from the recycle bin
8277

83-
An item can be restored from the recycle bin by issuing a `POST` to the given URL:
78+
An item can be restored to its original location by issuing a `POST` to `@recyclebin/{item_id}/restore`:
8479

8580
```{eval-rst}
8681
.. http:example:: curl httpie python-requests
@@ -91,9 +86,9 @@ An item can be restored from the recycle bin by issuing a `POST` to the given UR
9186
:language: http
9287
```
9388

94-
### Restore to specific target location
89+
### Restore to a specific location
9590

96-
You can specify a target path to restore the item to a different location than its original:
91+
Pass a `target_path` in the request body to restore the item to a different folder:
9792

9893
```{eval-rst}
9994
.. http:example:: curl httpie python-requests
@@ -106,7 +101,7 @@ You can specify a target path to restore the item to a different location than i
106101

107102
## Purge a specific item from the recycle bin
108103

109-
To permanently delete a specific item from the recycle bin, send a DELETE request to the `@recyclebin/{item_id}` endpoint:
104+
To permanently delete a specific item, send a `DELETE` request to `@recyclebin/{item_id}`:
110105

111106
```{eval-rst}
112107
.. http:example:: curl httpie python-requests
@@ -119,7 +114,7 @@ To permanently delete a specific item from the recycle bin, send a DELETE reques
119114

120115
## Empty the entire recycle bin
121116

122-
To permanently delete all items from the recycle bin, send a DELETE request to the `@recyclebin` endpoint:
117+
To permanently delete all items, send a `DELETE` request to `@recyclebin`:
123118

124119
```{eval-rst}
125120
.. http:example:: curl httpie python-requests

src/plone/restapi/services/recyclebin/configure.zcml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,6 @@
1414
name="@recyclebin"
1515
/>
1616

17-
<plone:service
18-
method="GET"
19-
factory=".get.RecycleBinGet"
20-
for="Products.CMFCore.interfaces.IFolderish"
21-
permission="cmf.ManagePortal"
22-
name="@recyclebin"
23-
/>
24-
2517
<plone:service
2618
method="POST"
2719
factory=".restore.RecycleBinRestore"

0 commit comments

Comments
 (0)