2018-06-23 17:31:12 +02:00
|
|
|
# Get messages
|
|
|
|
|
2020-04-28 20:00:46 +02:00
|
|
|
{generate_api_description(/messages:get)}
|
2018-06-23 17:31:12 +02:00
|
|
|
|
|
|
|
## Usage examples
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{start_tabs}
|
|
|
|
{tab|python}
|
2018-06-23 17:31:12 +02:00
|
|
|
|
|
|
|
{generate_code_example(python)|/messages:get|example}
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{tab|js}
|
2018-06-23 17:31:12 +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-23 17:31:12 +02:00
|
|
|
const config = {
|
2019-01-07 14:27:58 +01:00
|
|
|
zuliprc: 'zuliprc',
|
2018-06-23 17:31:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
zulip(config).then((client) => {
|
|
|
|
const readParams = {
|
|
|
|
stream,
|
|
|
|
type: 'stream',
|
|
|
|
anchor: res.id,
|
|
|
|
num_before: 1,
|
|
|
|
num_after: 1,
|
|
|
|
};
|
|
|
|
|
|
|
|
// Fetch messages anchored around id (1 before, 1 after)
|
|
|
|
return client.messages.retrieve(readParams);
|
|
|
|
}).then(console.log);
|
|
|
|
```
|
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{tab|curl}
|
|
|
|
|
2020-01-29 02:58:17 +01:00
|
|
|
{generate_code_example(curl, exclude=["client_gravatar", "apply_markdown", "use_first_unread_anchor"])|/messages:get|example}
|
2018-06-23 17:31:12 +02:00
|
|
|
|
2018-09-17 16:27:32 +02:00
|
|
|
{end_tabs}
|
2018-06-23 17:31:12 +02:00
|
|
|
|
2020-06-18 15:35:25 +02:00
|
|
|
## Parameters
|
2018-06-23 17:31:12 +02:00
|
|
|
|
|
|
|
{generate_api_arguments_table|zulip.yaml|/messages:get}
|
|
|
|
|
|
|
|
## Response
|
|
|
|
|
|
|
|
#### Return values
|
|
|
|
|
|
|
|
When a request is successful, this endpoint returns a dictionary
|
|
|
|
containing the following (in addition to the `msg` and `result` keys
|
|
|
|
present in all Zulip API responses).
|
|
|
|
|
2020-05-20 11:57:57 +02:00
|
|
|
{generate_return_values_table|zulip.yaml|/messages:get}
|
2018-06-23 17:31:12 +02:00
|
|
|
|
|
|
|
#### Example response
|
|
|
|
|
|
|
|
A typical successful JSON response may look like:
|
|
|
|
|
|
|
|
{generate_code_example|/messages:get|fixture(200)}
|
|
|
|
|
|
|
|
[status-messages]: /help/format-your-message-using-markdown#status-messages
|
2018-10-16 21:03:38 +02:00
|
|
|
[linkification-filters]: /help/add-a-custom-linkification-filter
|
2019-06-04 13:02:35 +02:00
|
|
|
[message-flags]: /api/update-message-flags#available-flags
|