Get drafts
GET https://chat.trabajo.gba.gob.ar/api/v1/drafts
Fetch all drafts for the current user.
Usage examples
curl -sSX GET -G https://chat.trabajo.gba.gob.ar/api/v1/drafts \
-u BOT_EMAIL_ADDRESS:BOT_API_KEY
Parameters
This endpoint does not accept any parameters.
Response
Return values
-
count
: integer
The number of drafts the user currently has. Also the
number of drafts returned under "drafts".
-
drafts
: (object)[]
Returns all of the current user's drafts, in order of last edit time
(with the most recently edited draft appearing first).
-
id
: integer
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
The type of the draft. Either unaddressed (empty string), "stream",
or "private" (for PMs and private group messages).
-
to
: (integer)[]
An array of the tentative target audience IDs. For "stream"
messages, this should contain exactly 1 ID, the ID of the
target stream. For private 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
For stream message drafts, the tentative topic name. For private
or unaddressed messages, this will be ignored and should ideally
be the empty string. Should not contain null bytes.
-
content
: string
The body of the draft. Should not contain null bytes.
-
timestamp
: number
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 response(s)
A typical successful JSON response may look like:
{
"count": 3,
"drafts": [
{
"content": "Let's add backend support for syncing drafts.",
"id": 1,
"timestamp": 1595479019.43915,
"to": [
3
],
"topic": "sync drafts",
"type": "stream"
},
{
"content": "What if we made it possible to sync drafts in Zulip?",
"id": 2,
"timestamp": 1595479020.43916,
"to": [
4
],
"topic": "",
"type": "private"
},
{
"content": "What if we made it possible to sync drafts in Zulip?",
"id": 3,
"timestamp": 1595479021.43916,
"to": [
4,
10
],
"topic": "",
"type": "private"
}
],
"msg": "",
"result": "success"
}