2018-06-01 18:58:07 +02:00
|
|
|
# Get topics in a stream
|
|
|
|
|
|
|
|
Get all the topics in a specific stream
|
|
|
|
|
|
|
|
`GET {{ api_url }}/v1/users/me/<stream_id>/topics`
|
|
|
|
|
|
|
|
## Usage examples
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{start_tabs}
|
|
|
|
{tab|python}
|
2018-06-01 18:58:07 +02:00
|
|
|
|
|
|
|
{generate_code_example(python)|/users/me/{stream_id}/topics:get|example}
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{tab|js}
|
2018-06-01 18:58:07 +02:00
|
|
|
|
|
|
|
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
|
|
|
```js
|
|
|
|
const zulip = require('zulip-js');
|
|
|
|
|
2019-01-07 14:27:58 +01:00
|
|
|
// Pass the path to your zuliprc file here.
|
2018-06-01 18:58:07 +02:00
|
|
|
const config = {
|
2019-01-07 14:27:58 +01:00
|
|
|
zuliprc: 'zuliprc',
|
2018-06-01 18:58:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
zulip(config).then((client) => {
|
|
|
|
// Get all the topics in stream with ID 1
|
|
|
|
return client.streams.topics.retrieve({ stream_id: 1 });
|
|
|
|
}).then(console.log);
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{tab|curl}
|
|
|
|
|
2019-05-16 22:38:53 +02:00
|
|
|
``` curl
|
2019-04-17 21:08:35 +02:00
|
|
|
curl -X GET {{ api_url }}/v1/users/me/<stream_id>/topics \
|
2018-09-17 16:27:32 +02:00
|
|
|
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
|
|
|
```
|
2018-06-01 18:58:07 +02:00
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{end_tabs}
|
2018-06-01 18:58:07 +02:00
|
|
|
|
|
|
|
## Arguments
|
|
|
|
|
|
|
|
{generate_api_arguments_table|zulip.yaml|/users/me/{stream_id}/topics:get}
|
|
|
|
|
|
|
|
## Response
|
|
|
|
|
|
|
|
#### Return values
|
|
|
|
|
|
|
|
* `topics`: An array of `topic` objects, which contain:
|
|
|
|
* `name`: The name of the topic.
|
|
|
|
* `max_id`: The message ID of the last message sent to this topic.
|
|
|
|
|
|
|
|
#### Example response
|
|
|
|
|
|
|
|
A typical successful JSON response may look like:
|
|
|
|
|
|
|
|
{generate_code_example|/users/me/{stream_id}/topics:get|fixture(200)}
|
|
|
|
|
|
|
|
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):
|
|
|
|
|
|
|
|
{generate_code_example|/users/me/{stream_id}/topics:get|fixture(400)}
|