Skip to main content
Version: 0.16

SieveUserScript

Defines a global Sieve script available for user imports.

This object can be configured from the WebUI under Settings › Sieve › User Scripts

Fields

name

Type: String · required

Name of the script

description

Type: String?

Description of the script

isActive

Type: Boolean · default: false

Whether the script is active

contents

Type: Text · required

Content of the script

JMAP API

The SieveUserScript object is available via the urn:stalwart:jmap capability.

x:SieveUserScript/get

This is a standard Foo/get method as defined in RFC 8620, Section 5.1.

This method requires the sysSieveUserScriptGet permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SieveUserScript/get",
{
"ids": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

x:SieveUserScript/set

This is a standard Foo/set method as defined in RFC 8620, Section 5.3.

Supports create, update, and destroy operations in a single call.

Create

This operation requires the sysSieveUserScriptCreate permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SieveUserScript/set",
{
"create": {
"new1": {
"contents": "Example",
"description": "Example",
"isActive": false,
"name": "Example"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

Update

This operation requires the sysSieveUserScriptUpdate permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SieveUserScript/set",
{
"update": {
"id1": {
"name": "updated value"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

Destroy

This operation requires the sysSieveUserScriptDestroy permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SieveUserScript/set",
{
"destroy": [
"id1"
]
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

x:SieveUserScript/query

This is a standard Foo/query method as defined in RFC 8620, Section 5.5.

This method requires the sysSieveUserScriptQuery permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:SieveUserScript/query",
{
"filter": {
"name": "example"
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

The x:SieveUserScript/query filter argument accepts the following conditions (combinable with AnyOf / AllOf / Not per RFC 8620):

ConditionKind
nametext

CLI

stalwart-cli wraps the same JMAP calls. See the CLI reference for installation, authentication, and general usage.

Fetch

stalwart-cli get sieve-user-script id1

Create

stalwart-cli create sieve-user-script \
--field name=Example \
--field description=Example \
--field isActive=false \
--field contents=Example

Query

stalwart-cli query sieve-user-script
stalwart-cli query sieve-user-script --where name=example

Update

stalwart-cli update sieve-user-script id1 --field description='Updated'

Delete

stalwart-cli delete sieve-user-script --ids id1