Create drafts

Create one or more drafts on the server. These drafts will be automatically synchronized to other clients via drafts events.

POST https://pelikan.zulipchat.com/api/v1/drafts

Usage examples

curl -sSX POST https://pelikan.zulipchat.com/api/v1/drafts \
    -u BOT_EMAIL_ADDRESS:BOT_API_KEY \
    --data-urlencode 'drafts=[{"content": "What are the contribution guidelines for this project?", "timestamp": 1595479019, "to": [1], "topic": "questions", "type": "stream"}]'

Parameters

drafts (object)[] optional

Example: [{"type": "stream", "to": [1], "topic": "questions", "content": "What are the contribution guidelines for this project?", "timestamp": 1595479019}]

A JSON-encoded list of containing new draft objects.


Response

Return values

  • ids: (integer)[] An array of the IDs for the drafts that were just created in the same order as they were submitted.

Example response

When all of the drafts in the request are valid, this endpoint will return an array of the IDs for the drafts that were just created in the same order as they were requested. If any of the drafts failed the validation step, then none of the drafts will be created and we would not get this status code. The typical JSON response in such a case is:

{
    "ids": [
        1,
        2,
        3
    ],
    "msg": "",
    "result": "success"
}

JSON response for when a draft targeted towards a stream does not specify exactly one stream ID:

{
    "code": "BAD_REQUEST",
    "msg": "Must specify exactly 1 stream ID for stream messages",
    "result": "error"
}