Update a linkifier

Update a linkifier, regular expression patterns that are automatically linkified when they appear in messages and topics.

PATCH https://z.labs.greyorange.com/api/v1/realm/filters/{filter_id}

Changes: New in Zulip 4.0 (feature level 57).

Usage examples

#!/usr/bin/env python3

import zulip

# Pass the path to your zuliprc file here.
client = zulip.Client(config_file="~/zuliprc")

# Update the linkifier (realm_filter) with ID 1
filter_id = 1
request = {
    "pattern": "#(?P<id>[0-9]+)",
    "url_format_string": "https://github.com/zulip/zulip/issues/%(id)s",
}

result = client.call_endpoint(
    url=f"/realm/filters/{filter_id}", method="PATCH", request=request
)
print(result)

curl -sSX PATCH https://z.labs.greyorange.com/api/v1/realm/filters/2 \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode 'pattern=#(?P<id>[0-9]+)' \
    --data-urlencode 'url_format_string=https://github.com/zulip/zulip/issues/%(id)s'

Parameters

filter_id integer required in path

Example: 2

The ID of the linkifier that you want to update.


pattern string required

Example: "#(?P<id>[0-9]+)"

The Python regular expression that should trigger the linkifier.


url_format_string string required

Example: "https://github.com/zulip/zulip/issues/%(id)s"

The URL used for the link. If you used named groups for the pattern, you can insert their content here with %(name_of_the_capturing_group)s.


Response

Example response

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success"
}