Draft
  • 16 Jun 2022
  • 2 Minutes to read
  • Dark
    Light

Draft

  • Dark
    Light

Article summary

Draft

Draft of ticket.

Draft JSON Format

Draft is represented as simple flat JSON objects with the following keys:

NameTypeDescription
ticketIdselfIncrementIdId of the ticket.
bodystringContent 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.
metadataobjectMessage metadata, Json format.
lastUpdatedByIdguidId of the agent who updates the draft recently.
lastUpdatedTimetimestampLast time when the draft was updated.
typestringType of draft. Allowed values are "text", "html", "video", "audio", "image", "file", "location", "quickReply", "webView".
attachmentsattachments[]Reference to DraftAttachment.

DraftAttachment JSON Format:

NameTypeDescription
idguidId of the attachment.
fileKeystringUnique key in file service.
namestringName of the attachment.
sizeintegerSize of the attachment.
ticketIdselfIncrementIdId of the ticket which the draft belongs to.
typestringType of the attachment. Allowed values are "video", "audio", "image", "file".
urlstringDownload URL of the attachment.

Get a single Draft

GET ticketing/tickets/{id}/draft

  • Parameters:

NameTypeinRequiredDescription
includestringquerynoAllowed value is "ticketingDraftAttachment".
  • Response:

Draft

  • 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:

NameTypeinRequiredDescription
bodystringbodynoContent 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.
metadataobjectbodyyesMessage metadata, Json format.
lastUpdatedByIdguidbodynoId of the agent who updates the draft recently.
lastUpdatedTimetimestampbodynoLast time when the draft was updated.
typestringbodyyesType of draft. Allowed values are "text", "html", "video", "audio", "image", "file", "location", "quickReply", "webView".
attachmentsattachments[]bodynoAttachment in draft message.
  • Response:

Draft

  • 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


Was this article helpful?

What's Next