Skip to main content
Version: 0.16

HttpLookup

Defines an HTTP-based lookup list.

This object can be configured from the WebUI under Settings › Lookups › HTTP Lists

Fields

namespace

Type: String · read-only

Unique identifier for this store when used in lookups

enable

Type: Boolean · default: true

Whether to enable this HTTP list

format

Type: HttpLookupFormat · required

Format of the list

isGzipped

Type: Boolean · default: false

Whether to use gzip compression when downloading the list

maxEntries

Type: UnsignedInt · default: 100000 · max: 1048576 · min: 1

Maximum number of entries allowed in the list. The list is truncated if it exceeds this limit.

maxEntrySize

Type: Size · default: 512 · max: 1048576 · min: 1

Maximum length of an entry in the list.

maxSize

Type: Size · default: "100mb" · max: 1073741824 · min: 10

Maximum size of the list. The list is truncated if it exceeds this size.

refresh

Type: Duration · default: "12h"

How often to refresh the list

retry

Type: Duration · default: "1h"

How long to wait before retrying to download the list in case of failure.

timeout

Type: Duration · default: "30s"

How long to wait for the list to download before timing out

url

Type: Uri · required

URL of the list

JMAP API

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

x:HttpLookup/get

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

This method requires the sysHttpLookupGet permission.

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

x:HttpLookup/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 sysHttpLookupCreate permission.

curl -X POST https://mail.example.com/api \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"methodCalls": [
[
"x:HttpLookup/set",
{
"create": {
"new1": {
"enable": true,
"format": {
"@type": "Csv",
"indexKey": 0,
"indexValue": 1000,
"separator": ",",
"skipFirst": false
},
"isGzipped": false,
"maxEntries": 100000,
"maxEntrySize": 512,
"maxSize": "100mb",
"refresh": "12h",
"retry": "1h",
"timeout": "30s",
"url": "https://example.com"
}
}
},
"c1"
]
],
"using": [
"urn:ietf:params:jmap:core",
"urn:stalwart:jmap"
]
}'

Update

This operation requires the sysHttpLookupUpdate permission.

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

Destroy

This operation requires the sysHttpLookupDestroy permission.

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

x:HttpLookup/query

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

This method requires the sysHttpLookupQuery permission.

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

CLI

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

Fetch

stalwart-cli get http-lookup id1

Create

stalwart-cli create http-lookup \
--field enable=true \
--field 'format={"@type":"Csv","indexKey":0,"indexValue":1000,"separator":",","skipFirst":false}' \
--field isGzipped=false \
--field maxEntries=100000 \
--field maxEntrySize=512 \
--field maxSize=100mb \
--field refresh=12h \
--field retry=1h \
--field timeout=30s \
--field url=https://example.com

Query

stalwart-cli query http-lookup

Update

stalwart-cli update http-lookup id1 --field description='Updated'

Delete

stalwart-cli delete http-lookup --ids id1

Nested types

HttpLookupFormat

Format of HTTP lookup lists.

  • Csv: CSV. Carries the fields of HttpLookupCsv.
  • List: List. No additional fields.

HttpLookupCsv

CSV parsing settings for HTTP lookup lists.

indexKey

Type: UnsignedInt · default: 0

The position of the key field in the HTTP List.

indexValue

Type: UnsignedInt?

The position of the value field in the HTTP List.

separator

Type: String · default: ","

The separator character used to parse the HTTP list.

skipFirst

Type: Boolean · default: false

Whether to skip the first line of the list