--- title: "Draft" slug: "server-api-ticketing-draft" updated: 2022-06-16T07:22:51Z published: 2022-06-16T07:22:51Z canonical: "developer.comm100.com/server-api-ticketing-draft" --- > ## Documentation Index > Fetch the complete documentation index at: https://developer.comm100.com/llms.txt > Use this file to discover all available pages before exploring further. # Draft ## Draft Draft of ticket. - `Draft` - Draft Manage - `GET ticketing/tickets/{id}/draft` - [Get a single Draft](/docs/server-api-ticketing-draft#get-a-single-draft) - `PUT ticketing/tickets/{id}/draft` - [Update the Draft](/docs/server-api-ticketing-draft#update-the-draft) - `DELETE ticketing/tickets/{id}/draft` - [Remove the Draft](/docs/server-api-ticketing-draft#remove-the-draft) ### Draft JSON Format Draft is represented as simple flat JSON objects with the following keys: | Name | Type | Description | | --- | --- | --- | | `ticketId` | selfIncrementId | Id of the ticket. | | `body` | string | Content of the draft. You can pass both plaintext and base64 encoded text. If the request containing plaintext is blocked by comm100 WAF, use base64 format. When using base64, add "data:text/plain;base64," before the content. | | `metadata` | object | Message metadata, Json format. | | `lastUpdatedById` | guid | Id of the agent who updates the draft recently. | | `lastUpdatedTime` | timestamp | Last time when the draft was updated. | | `type` | string | Type of draft. Allowed values are "text", "html", "video", "audio", "image", "file", "location", "quickReply", "webView". | | `attachments` | [attachments[]](/docs/server-api-ticketing-draft#draftattachment-json-format) | Reference to DraftAttachment. | ### DraftAttachment JSON Format: | Name | Type | Description | | --- | --- | --- | | `id` | guid | Id of the attachment. | | `fileKey` | string | Unique key in file service. | | `name` | string | Name of the attachment. | | `size` | integer | Size of the attachment. | | `ticketId` | selfIncrementId | Id of the ticket which the draft belongs to. | | `type` | string | Type of the attachment. Allowed values are "video", "audio", "image", "file". | | `url` | string | Download URL of the attachment. | ### Get a single Draft `GET ticketing/tickets/{id}/draft` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `include` | string | query | no | Allowed value is "ticketingDraftAttachment". | - #### Response: [Draft](/docs/server-api-ticketing-draft#draft-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11/draft \ -X 'GET' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 200 OK ``` { "ticketId": "11", "body": "data:text/plain;base64,PHA+MTExPC9wPg==", "metadata": { "channel": null, "source": null, "decoration": { "files": null, "location": null, "buttons": null, "quickReplies": null, "email": { "from": null, "to": null, "cc": "test@163.com;", "bcc": null, "subject": "111", "quote": "", "ifHasAttachmentNotReceived": false } }, "context": null }, "lastUpdatedById": "bddb18ba-b3f7-4e1a-8636-f8467b6c13b7", "lastUpdatedTime": "2021-04-29T01:22:48.992Z", "type": "html", "attachments": [ { "id": "7cee5281-95b8-43cc-8c1e-f6424d69f002", "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7", "name": "my file", "size": 10, "ticketId": "100", "type": "file", "url": "http://myfile/url" } ] } ``` ### Update the Draft `PUT ticketing/tickets/{id}/draft` - #### Parameters: | Name | Type | in | Required | Description | | --- | --- | --- | --- | --- | | `body` | string | body | no | Content of the draft. You can pass both plaintext and base64 encoded text. If the request containing plaintext is blocked by comm100 WAF, use base64 format. When using base64, add "data:text/plain;base64," before the content. | | `metadata` | object | body | yes | Message metadata, Json format. | | `lastUpdatedById` | guid | body | no | Id of the agent who updates the draft recently. | | `lastUpdatedTime` | timestamp | body | no | Last time when the draft was updated. | | `type` | string | body | yes | Type of draft. Allowed values are "text", "html", "video", "audio", "image", "file", "location", "quickReply", "webView". | | `attachments` | [attachments[]](/docs/server-api-ticketing-draft#draftattachment-json-format) | body | no | Attachment in draft message. | - #### Response: [Draft](/docs/server-api-ticketing-draft#draft-json-format) - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11/draft \ -X 'PUT' \ -H 'Authorization: Bearer {access_token}' \ -H 'Content-Type: application/json' \ -D '{"body":"data:text/plain;base64,PHA+MTExPC9wPg==","metadata":{"channel":null,"source":null,"decoration":{"files":null,"location":null,"buttons":null,"quickReplies":null,"email":{"from":null,"to":null,"cc":"test@163.com;","bcc":null,"subject":"111","quote":"","ifHasAttachmentNotReceived":false}},"context":null},"lastUpdatedById":"bddb18ba-b3f7-4e1a-8636-f8467b6c13b7","lastUpdatedTime":"2021-04-29T01:22:48.992Z","type":"html","attachments":[{"fileKey":"isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7","name":"my file","size":10,"ticketId":"100","type":"file","url":"http://myfile/url"}]}' ``` Response: HTTP/1.1 200 OK ``` { "ticketId": "11", "body": "data:text/plain;base64,PHA+MTExPC9wPg==", "metadata": { "channel": null, "source": null, "decoration": { "files": null, "location": null, "buttons": null, "quickReplies": null, "email": { "from": null, "to": null, "cc": "test@163.com;", "bcc": null, "subject": "111", "quote": "", "ifHasAttachmentNotReceived": false } }, "context": null }, "lastUpdatedById": "bddb18ba-b3f7-4e1a-8636-f8467b6c13b7", "lastUpdatedTime": "2021-04-29T01:22:48.992Z", "type": "html", "attachments": [ { "id": "7cee5281-95b8-43cc-8c1e-f6424d69f002", "fileKey": "isqo-ngLG1Vw7Uh0ieeIGXSjVoAX2DhmQKeWmi7", "name": "my file", "size": 10, "ticketId": "100", "type": "file", "url": "http://myfile/url" } ] } ``` ### Remove the Draft `DELETE ticketing/tickets/{id}/draft` - #### Parameters: No Parameters - #### Response: No Content - #### Example Sample Request: ``` curl https://api11.comm100.io/v4/ticketing/tickets/11/draft \ -X 'DELETE' \ -H 'Authorization: Bearer {access_token}' \ ``` Response: HTTP/1.1 204 No Content