Get topics in a stream

Get all the topics in a specific stream

GET https://zulip.dioco.io/api/v1/users/me/{stream_id}/topics

Usage examples

#!/usr/bin/env python3

import zulip

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

result = client.get_stream_topics(stream_id)
print(result)

More examples and documentation can be found here.

const Zulip = require('zulip-js');

// Pass the path to your zuliprc file here.
const config = { zuliprc: 'zuliprc' };

Zulip(config).then(async (client) => {
    // Get all the topics in stream with ID 1
    return client.streams.topics.retrieve({stream_id: 1});
}).then(console.log).catch(console.err);

curl -sSX GET -G https://zulip.dioco.io/api/v1/users/me/42/topics \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY

Parameters

stream_id required in path

Example: 42

The ID of the stream to access.


Response

Return values

  • topics: An array of topic objects.

    • max_id: The message ID of the last message sent to this topic.

    • name: The name of the topic.

Example response

A typical successful JSON response may look like:

{
    "msg": "",
    "result": "success",
    "topics": [
        {
            "max_id": 26,
            "name": "Denmark3"
        },
        {
            "max_id": 23,
            "name": "Denmark1"
        },
        {
            "max_id": 6,
            "name": "Denmark2"
        }
    ]
}

An example JSON response for when the user is attempting to fetch the topics of a non-existing stream (or also a private stream they don't have access to):

{
    "code": "BAD_REQUEST",
    "msg": "Invalid stream id",
    "result": "error"
}