2017-12-29 23:58:37 +01:00
|
|
|
# Get stream ID
|
|
|
|
|
|
|
|
Get the unique ID of a given stream.
|
|
|
|
|
|
|
|
`GET {{ api_url }}/v1/get_stream_id`
|
|
|
|
|
|
|
|
## Usage examples
|
|
|
|
|
|
|
|
<div class="code-section" markdown="1">
|
|
|
|
<ul class="nav">
|
|
|
|
<li data-language="python">Python</li>
|
2018-01-13 22:57:05 +01:00
|
|
|
<li data-language="javascript">JavaScript</li>
|
2018-01-22 22:49:30 +01:00
|
|
|
<li data-language="curl">curl</li>
|
2017-12-29 23:58:37 +01:00
|
|
|
</ul>
|
|
|
|
<div class="blocks">
|
|
|
|
|
|
|
|
<div data-language="curl" markdown="1">
|
|
|
|
|
|
|
|
```
|
|
|
|
curl {{ api_url }}/v1/get_stream_id?stream=Denmark \
|
|
|
|
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
|
|
|
|
```
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div data-language="python" markdown="1">
|
|
|
|
|
2018-02-02 19:28:35 +01:00
|
|
|
{generate_code_example|get-stream-id|example}
|
2017-12-29 23:58:37 +01:00
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2018-01-13 22:57:05 +01:00
|
|
|
<div data-language="javascript" markdown="1">
|
|
|
|
More examples and documentation can be found [here](https://github.com/zulip/zulip-js).
|
|
|
|
```js
|
|
|
|
const zulip = require('zulip-js');
|
|
|
|
|
|
|
|
// Download zuliprc-dev from your dev server
|
|
|
|
const config = {
|
|
|
|
zuliprc: 'zuliprc-dev',
|
|
|
|
};
|
|
|
|
|
|
|
|
zulip(config).then((client) => {
|
|
|
|
// Get the ID of a given stream
|
|
|
|
client.streams.getStreamId('Denmark').then(console.log);
|
|
|
|
});
|
|
|
|
```
|
|
|
|
</div>
|
|
|
|
|
2017-12-29 23:58:37 +01:00
|
|
|
</div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
2018-01-20 22:03:05 +01:00
|
|
|
## Arguments
|
|
|
|
|
|
|
|
**Note**: The following arguments are all URL query parameters.
|
|
|
|
|
|
|
|
{generate_api_arguments_table|arguments.json|get-stream-id.md}
|
|
|
|
|
2017-12-29 23:58:37 +01:00
|
|
|
## Response
|
|
|
|
|
|
|
|
#### Return values
|
|
|
|
|
|
|
|
* `stream_id`: The ID of the given stream.
|
|
|
|
|
|
|
|
#### Example response
|
|
|
|
|
|
|
|
A typical successful JSON response may look like:
|
|
|
|
|
2018-01-28 00:06:45 +01:00
|
|
|
{generate_code_example|get-stream-id|fixture}
|
2017-12-29 23:58:37 +01:00
|
|
|
|
|
|
|
An example of a JSON response for when the supplied stream does not
|
|
|
|
exist:
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
'code':'BAD_REQUEST',
|
|
|
|
'msg':"Invalid stream name 'nonexistent'",
|
|
|
|
'result':'error'
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
An example of a JSON response for when the `stream` query parameter is
|
|
|
|
not provided:
|
|
|
|
|
|
|
|
```
|
|
|
|
{
|
|
|
|
"msg":"Missing 'stream' argument",
|
|
|
|
"result":"error",
|
|
|
|
"var_name":"stream",
|
|
|
|
"code":"REQUEST_VARIABLE_MISSING"
|
|
|
|
}
|
|
|
|
```
|