Add a code playground


Configure code playgrounds for the organization.

Changes: New in Zulip 4.0 (feature level 49). A parameter encoding bug was fixed 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")

# Add a code playground for Python.
request = {
    "name": "Python playground",
    "pygments_language": "Python",
    "url_template": "{code}",
result = client.call_endpoint(url="/realm/playgrounds", method="POST", request=request)

curl -sSX POST \
    --data-urlencode 'name=Python playground' \
    --data-urlencode pygments_language=Python \
    --data-urlencode 'url_template={code}'


name string required

Example: "Python playground"

The user-visible display name of the playground which can be used to pick the target playground, especially when multiple playground options exist for that programming language.

pygments_language string required

Example: "Python"

The name of the Pygments language lexer for that programming language.

url_template string required

Example: "{code}"

The RFC 6570 compliant URL template for the playground. The template should contain exactly one variable named code, which determines how the extracted code should be substituted in the playground URL.

Changes: New in Zulip 8.0 (feature level 196). This replaced the url_prefix parameter, which was used to construct URLs by just concatenating url_prefix and code.


Return values

  • id: integer

    The numeric ID assigned to this playground.

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:

    "id": 1,
    "msg": "",
    "result": "success"