Edit a draft
PATCH https://chat.zulip.org/api/v1/drafts/{draft_id}
Edit a draft on the server. The edit will be automatically
synchronized to other clients via drafts
events.
Usage examples
curl -sSX PATCH https://chat.zulip.org/api/v1/drafts/2 \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY \
--data-urlencode 'draft={"content": "how tough is a Lamy Safari?", "timestamp": 1595479019, "to": [1], "topic": "questions", "type": "stream"}'
Parameters
draft_id integer required in path
Example: 2
The ID of the draft to be edited.
draft object required
Example: {"type": "stream", "to": [1], "topic": "questions", "content": "how tough is a Lamy Safari?", "timestamp": 1595479019}
A dictionary for representing a message draft.
draft object details:
-
id
: integer optional The unique ID of the draft. It will only used whenever the drafts are
fetched. This field should not be specified when the draft is being
created or edited.
-
type
: string required The type of the draft. Either unaddressed (empty string), "stream"
,
or "private"
(for one-on-one and group direct messages).
Must be one of: ""
, "stream"
, "private"
.
-
to
: (integer)[] required An array of the tentative target audience IDs. For channel
messages, this should contain exactly 1 ID, the ID of the
target channel. For direct messages, this should be an array
of target user IDs. For unaddressed drafts, this is ignored,
and clients should send an empty array.
-
topic
: string required For channel message drafts, the tentative topic name. For direct
or unaddressed messages, this will be ignored and should ideally
be the empty string. Should not contain null bytes.
-
content
: string required The body of the draft. Should not contain null bytes.
-
timestamp
: integer optional A Unix timestamp (seconds only) representing when the draft was
last edited. When creating a draft, this key need not be present
and it will be filled in automatically by the server.
Example: 1595479019
Response
Example response(s)
Changes: As of Zulip 7.0 (feature level 167), if any
parameters sent in the request are not supported by this
endpoint, a successful JSON response will include an
ignored_parameters_unsupported
array.
A typical successful JSON response may look like:
{
"msg": "",
"result": "success"
}
A typical failed JSON response for when no draft exists with
the provided ID:
{
"code": "BAD_REQUEST",
"msg": "Draft does not exist",
"result": "error"
}