Add a code playground

Configure code playgrounds for the organization.

POST https://z.labs.greyorange.com/api/v1/realm/playgrounds

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_prefix": "https://python.example.com",
}
result = client.call_endpoint(url="/realm/playgrounds", method="POST", request=request)
print(result)

curl -sSX POST https://z.labs.greyorange.com/api/v1/realm/playgrounds \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode 'name=Python playground' \
    --data-urlencode pygments_language=Python \
    --data-urlencode url_prefix=https://python.example.com

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_prefix string required

Example: "https://python.example.com"

The url prefix for the playground.


Response

Return values

  • id: integer

    The numeric ID assigned to this playground.

Example response

A typical successful JSON response may look like:

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