Add a code playground
POST https://chat.h2t.iar.kit.edu/api/v1/realm/playgrounds
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 realm playground for Python
request = {
"name": "Python playground",
"pygments_language": "Python",
"url_template": "https://python.example.com?code={code}",
}
result = client.call_endpoint(url="/realm/playgrounds", method="POST", request=request)
print(result)
curl -sSX POST https://chat.h2t.iar.kit.edu/api/v1/realm/playgrounds \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
--data-urlencode 'name=Python playground' \
--data-urlencode pygments_language=Python \
--data-urlencode 'url_template=https://python.example.com?code={code}'
Parameters
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: "https://python.example.com?code={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
.
Response
Return values
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"
}