On 9/24/26 09:49, alain williams wrote:
Where is the API for this written down, ie defined, so that I can look at it ?
The API you are looking at is Mailman;'s REST API. It is documented at <https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/r...> of which <https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/rest/docs/p...> is a part.
Following those docs is somewhat tricky as they use helper functions so that the doctests work. In practice, instead of doing something like
json =
call_http('http://localhost:8001/3.0/lists/my-list@leavesden.org.uk/held')
in mailman shell, you would just do
curl -urestadmin:restpass
http://localhost:8001/3.0/lists/my-list@leavesden.org.uk/held
If you want to do these things in mailman shell you're better off
dealing directly with Mailman's models and methods, although
documentation for those things is just the source code.
For example
$ mailman shell -l my-list@leavesden.org.uk
Welcome to the GNU Mailman shell
Use commit() to commit changes.
Use abort() to discard changes since the last commit.
Exit with ctrl+D does an implicit commit() but exit() does not.
The variable 'm' is the test_hold@msapiro.net mailing list
>>> # get the ids of the held messages
>>> for rq in IListRequests(m).held_requests:
... print(rq.id)
...
>>> # The above prints the request IDs. You can then handle them with
>>> from mailman.app.moderator import handle_message
>>> # If you want to discard them all you could do
>>> for rq in IListRequests(m).held_requests:
... handle_message(m, rq.id, Action.discard)
...
>>> # or you could handle them individually with various actions like
>>> # 'accept', 'defer', 'discard' or 'reject'
>>> # and when you're satisfied
>>> commit()
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan