Skip to content

SpamTrainingSample

Stores an email sample used for spam classifier training.

This object can be configured from the WebUI under Account › Spam Samples

Type: EmailAddress · read-only · server-set

Email address of the sender of the message associated with this training sample

Type: String · server-set

Subject of the message associated with this training sample

Type: BlobId · read-only

Reference to the stored message content

Type: Boolean · read-only · default: false

Indicates whether the sample is spam (true) or ham (false)

Type: Id<Account>? · read-only

Identifier of the account associated with this training sample

Type: UTCDateTime · server-set

Timestamp when the training sample is scheduled to expire

Type: Boolean · read-only · default: false

Indicates whether the training sample should be deleted after being used for training

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

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

This method requires the sysSpamTrainingSampleGet permission.

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

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.

This operation requires the sysSpamTrainingSampleCreate permission.

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

This operation requires the sysSpamTrainingSampleUpdate permission.

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

This operation requires the sysSpamTrainingSampleDestroy permission.

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

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

This method requires the sysSpamTrainingSampleQuery permission.

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

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

ConditionKind
accountIdid of Account

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

Terminal window
stalwart-cli get SpamTrainingSample id1
Terminal window
stalwart-cli create SpamTrainingSample
Terminal window
stalwart-cli query SpamTrainingSample
stalwart-cli query SpamTrainingSample --where accountId=id1
Terminal window
stalwart-cli update SpamTrainingSample id1 --field description='updated value'
Terminal window
stalwart-cli delete SpamTrainingSample --ids id1