Update a bot's stored data

PUT https://sneeuwbal.zulipchat.com/api/v1/bot_storage

Note: This endpoint is only available to bot user accounts.

Add or update data stored for a bot user.

Each bot has a limited storage set by the server, which normally is a default of 10,000,000 characters.

Changes: Prior to Zulip 12.0 (feature level 494), users who were not bots could access this endpoint.

Usage examples

#!/usr/bin/env python3

import zulip

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

# Store value of "bar" for the key "foo" for a bot user.
result = client.update_storage({"storage": {"foo": "bar"}})
print(result)

The -u line implements HTTP Basic authentication. See the Authorization header documentation for how to get those credentials for Zulip users and bots.

curl -sSX PUT https://sneeuwbal.zulipchat.com/api/v1/bot_storage \
    -u EMAIL_ADDRESS:API_KEY \
    --data-urlencode 'storage={"foo": "bar"}'

Parameters

storage object required

Example: {"foo": "bar"}

A JSON-encoded dictionary mapping string keys to string values that will be added to the bot's storage.

If the bot's storage already has a specific key, then the value stored for that key will be updated for the new value.


Response

Example response(s)

Changes: As of Zulip 7.0 (feature level 167), if any parameters sent in the request are not supported by this endpoint, a successful JSON response will include an ignored_parameters_unsupported array.

A typical successful JSON response may look like:

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

A typical failed JSON response when the request would exceed the server's storage size limit:

{
    "code": "BAD_REQUEST",
    "msg": "Request exceeds storage limit by 42 characters. The limit is 10000000 characters.",
    "result": "error"
}

A typical failed JSON response when the user is not a bot:

{
    "code": "PERMISSION_DENIED",
    "msg": "Must be a bot user",
    "result": "error"
}