Skip to content

Add endpoint for managing recycle bin#1920

Open
rohnsha0 wants to merge 16 commits intomainfrom
rohnsha0-feat-recyclebin-api
Open

Add endpoint for managing recycle bin#1920
rohnsha0 wants to merge 16 commits intomainfrom
rohnsha0-feat-recyclebin-api

Conversation

@rohnsha0
Copy link
Copy Markdown
Member

@rohnsha0 rohnsha0 commented Apr 27, 2025

should be merged after #4166


📚 Documentation preview 📚: https://plonerestapi--1920.org.readthedocs.build/en/1920/endpoints/recycle-bin.html

@mister-roboto
Copy link
Copy Markdown

@rohnsha0 thanks for creating this Pull Request and helping to improve Plone!

TL;DR: Finish pushing changes, pass all other checks, then paste a comment:

@jenkins-plone-org please run jobs

To ensure that these changes do not break other parts of Plone, the Plone test suite matrix needs to pass, but it takes 30-60 min. Other CI checks are usually much faster and the Plone Jenkins resources are limited, so when done pushing changes and all other checks pass either start all Jenkins PR jobs yourself, or simply add the comment above in this PR to start all the jobs automatically.

Happy hacking!

@rohnsha0 rohnsha0 linked an issue Apr 27, 2025 that may be closed by this pull request
Copy link
Copy Markdown
Contributor

@stevepiercy stevepiercy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly just strings and docs matters.

Comment thread news/1919.feature Outdated
Comment thread src/plone/restapi/services/recyclebin/purge.py Outdated
Comment thread src/plone/restapi/services/recyclebin/purge.py Outdated
Comment thread src/plone/restapi/services/recyclebin/restore.py Outdated
Comment thread src/plone/restapi/tests/test_recyclebin.py Outdated
Comment thread src/plone/restapi/services/recyclebin/get.py Outdated
Comment thread src/plone/restapi/tests/test_recyclebin.py Outdated
Comment thread src/plone/restapi/tests/test_recyclebin.py Outdated
Comment thread src/plone/restapi/tests/test_recyclebin.py Outdated
Comment thread src/plone/restapi/services/recyclebin/documentation.md
rohnsha0 and others added 2 commits April 28, 2025 06:21
Co-authored-by: Steve Piercy <web@stevepiercy.com>
Comment thread docs/source/endpoints/recycle-bin.md Outdated
Comment thread docs/source/endpoints/recycle-bin.md Outdated
Comment thread src/plone/restapi/services/recyclebin/documentation.md
Comment thread docs/source/endpoints/recycle-bin.md Outdated
Comment on lines +9 to +12
```http-example
GET /@recyclebin HTTP/1.1
Accept: application/json
```
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and all http example requests and responses should follow the pattern of other documentation in this directory. This allows tests to run both on the documentation and on the code. Here's example MyST markup that pulls in files as literal includes. You'll also need to create the included files.

## Reading add-ons records
Reading a single record:
```{eval-rst}
.. http:example:: curl httpie python-requests
:request: ../../../src/plone/restapi/tests/http-examples/addons_get.req
```
Example response:
```{literalinclude} ../../../src/plone/restapi/tests/http-examples/addons_get.resp
:language: http
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steve is right--look at some of the other services for examples. We're supposed to have tests like the ones in test_documentation.py which actually call the endpoint, then record the request and response so they can be included in the docs. That way we will notice if something changes the response in the future.

"purge": f"{self.context.absolute_url()}/@recyclebin-purge",
},
}
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should paginate the results using the same batching utility that other services use. This service will also need to take params for the filters needed to support the UI.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is resolved i think: i see pagination with HypermediaBatch



class RecycleBinPurge(Service):
"""POST /@recyclebin-purge - Permanently delete an item from the recycle bin"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a DELETE request to /@recyclebin/<item_id>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also support a DELETE on /@recyclebin for emptying the entire recycle bin.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this is resolved as well

Comment thread src/plone/restapi/services/recyclebin/restore.py Outdated


class RecycleBinGet(Service):
"""GET /@recyclebin - List items in the recycle bin"""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll also want a GET for /@recyclebin/<item_id> to get one specific item (for the detail page).

Comment thread docs/source/endpoints/recycle-bin.md Outdated
Comment on lines +9 to +12
```http-example
GET /@recyclebin HTTP/1.1
Accept: application/json
```
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Steve is right--look at some of the other services for examples. We're supposed to have tests like the ones in test_documentation.py which actually call the endpoint, then record the request and response so they can be included in the docs. That way we will notice if something changes the response in the future.

@cekk
Copy link
Copy Markdown
Member

cekk commented Mar 19, 2026

@davisagli i've seen that tests here are all mocks.
Is it ok or is there a way to use a CMFPlone branch to test the real tool?

@davisagli
Copy link
Copy Markdown
Member

@cekk I would definitely prefer to have tests using the real tool instead of mocks.

There is a plip configuration for buildout.coredev that installs all the in-progress branches together: https://github.com/plone/buildout.coredev/blob/6.2/plips/plip-recycle-bin.cfg

Or if you don't want to use buildout, you could add the checkouts to mx.ini in this branch, for now.

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Mar 20, 2026

Documentation build overview

📚 plone.restapi | 🛠️ Build #31904397 | 📁 Comparing f1fb472 against latest (abebc6b)


🔍 Preview build

Show files changed (5 files in total): 📝 4 modified | ➕ 1 added | ➖ 0 deleted
File Status
index.html 📝 modified
endpoints/index.html 📝 modified
endpoints/querystringsearch.html 📝 modified
endpoints/recycle-bin.html ➕ added
endpoints/registry.html 📝 modified

Co-authored-by: Steve Piercy <web@stevepiercy.com>
@pnicolli pnicolli moved this from Todo to In progress in Bucharest Sprint 2026 Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

Add Endpoint for Recycle bin

7 participants