From 73c9450d8a9df454889b7c490b201a2239b122bc Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 29 Aug 2019 16:15:19 -0700 Subject: [PATCH] docs: Expand documentation on using IDs in narrows. --- templates/zerver/api/construct-narrow.md | 29 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/templates/zerver/api/construct-narrow.md b/templates/zerver/api/construct-narrow.md index 4e60674e68..aa24f67f86 100644 --- a/templates/zerver/api/construct-narrow.md +++ b/templates/zerver/api/construct-narrow.md @@ -37,9 +37,28 @@ as a list of simple objects, as follows: ``` The full set of search/narrowing options supported by the Zulip API is -documented in -[the Zulip Help Center article on search](/help/search-for-messages). -There are a few additional options that we don't document there -because they are primarily useful to API clients: +documented in [the Zulip Help Center article on +search](/help/search-for-messages). There are a few additional +options, new in Zulip 2.1, that we don't document there because they +are primarily useful to API clients: -* `pm-with:1234`: Search 1-on-1 messages by user ID `1234`. +* `pm-with:1234`: Search 1-on-1 messages between you and user ID `1234`. +* `sender:1234`: Search 1-on-1 messages sent by user ID `1234`. +* `stream:1234`: Search 1-on-1 messages sent to the stream with ID `123`. +* `group-pm-with:1234`: Search private messages including the user with ID `1234`. + +For example, to query messages sent by a user 1234 to stream 123, the +correct JSON-encoded query is: + +```json +[ + { + "operator": "sender", + "operand": 1234 + }, + { + "operator": "stream", + "operand": 123 + } +] +```