This is an automated email from the ASF dual-hosted git repository. btellier pushed a commit to branch 3.9.x in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 227ca2c38223cbe578a2afe38910ba67900c7b60 Author: Rene Cordier <[email protected]> AuthorDate: Wed Sep 24 16:31:00 2025 +0700 JAMES-4148 Webadmin route to run a filtering rule on a mailbox of a user --- .../modules/servers/partials/operate/webadmin.adoc | 60 ++++++++++++++++++++++ src/site/markdown/server/manage-webadmin.md | 59 +++++++++++++++++++++ 2 files changed, 119 insertions(+) diff --git a/docs/modules/servers/partials/operate/webadmin.adoc b/docs/modules/servers/partials/operate/webadmin.adoc index c42505965a..fa0324519b 100644 --- a/docs/modules/servers/partials/operate/webadmin.adoc +++ b/docs/modules/servers/partials/operate/webadmin.adoc @@ -1800,6 +1800,66 @@ the following `additionalInformation`: } .... +=== Running a filtering rule on a mailbox + +.... +curl -XPOST http://ip:port/users/{usernameToBeUsed}/mailboxes/{mailboxName}/messages?action=triage \ +-d '{ + "id": "1", + "name": "rule 1", + "action": { + "appendIn": { + "mailboxIds": ["23"] + } + }, + "conditionGroup": { + "conditionCombiner": "OR", + "conditions": [ + { + "comparator": "contains", + "field": "subject", + "value": "plop" + }, + { + "comparator": "exactly-equals", + "field": "from", + "value": "[email protected]" + } + ] + } +}' +.... + +Will schedule a task for running a filtering rule passed as payload in ``mailboxName`` mailbox of ``usernameToBeUsed``. + +link:#_endpoints_returning_a_task[More details about endpoints returning +a task]. + +Resource name `usernameToBeUsed` should be an existing user. + +Resource name `mailboxName` should not be empty, nor contain `% *` characters, nor starting with `#`. + +Response codes: + +* 201: Success. Corresponding task id is returned. +* 400: Invalid mailbox name +* 400: Invalid JSON payload +* 404: Invalid get on user mailboxes. The `username` or `mailboxName` does not exit + +The scheduled task will have the following type `RunRulesOnMailboxTask` and +the following `additionalInformation`: + +.... +{ + "mailboxName": "mbx1", + "rulesOnMessagesApplySuccessfully": 9, + "rulesOnMessagesApplyFailed": 3, + "timestamp": "2024-12-03T10:15:30Z", + "type": "RunRulesOnMailboxTask", + "username": "[email protected]" +} +.... + === Subscribing a user to all of its mailboxes .... diff --git a/src/site/markdown/server/manage-webadmin.md b/src/site/markdown/server/manage-webadmin.md index b87c3bb03b..3b2cff8de5 100644 --- a/src/site/markdown/server/manage-webadmin.md +++ b/src/site/markdown/server/manage-webadmin.md @@ -1744,6 +1744,65 @@ the following `additionalInformation`: } ``` +### Running a filtering rule on a mailbox + +``` +curl -XPOST http://ip:port/users/{usernameToBeUsed}/mailboxes/{mailboxName}/messages?action=triage \ +-d '{ + "id": "1", + "name": "rule 1", + "action": { + "appendIn": { + "mailboxIds": ["23"] + } + }, + "conditionGroup": { + "conditionCombiner": "OR", + "conditions": [ + { + "comparator": "contains", + "field": "subject", + "value": "plop" + }, + { + "comparator": "exactly-equals", + "field": "from", + "value": "[email protected]" + } + ] + } +}' +``` + +Will schedule a task for running a filtering rule passed as payload in ``mailboxName`` mailbox of ``usernameToBeUsed``. + +[More details about endpoints returning a task](#Endpoints_returning_a_task). + +Resource name `usernameToBeUsed` should be an existing user. + +Resource name `mailboxName` should not be empty, nor contain `% *` characters, nor starting with `#`. + +Response codes: + +* 201: Success. Corresponding task id is returned. +* 400: Invalid mailbox name +* 400: Invalid JSON payload +* 404: Invalid get on user mailboxes. The `username` or `mailboxName` does not exit + +The scheduled task will have the following type `RunRulesOnMailboxTask` and +the following `additionalInformation`: + +``` +{ + "mailboxName": "mbx1", + "rulesOnMessagesApplySuccessfully": 9, + "rulesOnMessagesApplyFailed": 3, + "timestamp": "2024-12-03T10:15:30Z", + "type": "RunRulesOnMailboxTask", + "username": "[email protected]" +} +``` + ### Subscribing a user to all of its mailboxes ``` --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
