NextGen Knowledge Center

The Attachment Object

When using these methods, you will likely be working with a special class called Attachment. This class is documented in the User API. A few of the available methods are documented here:

Create a new Attachment

  • new Attachment()
  • new Attachment(id, content, type)
  • new Attachment(id, content, charset, type)
    idThe unique ID of the attachment.
    contentThe content (String or byte array) to store for the attachment.
    charsetIf the content passed in is a string, this is the charset encoding to convert the string to bytes with. If the content is a String and a charset is not used, UTF-8 will be used as the charset.
    typeThe MIME type of the attachment.

Retrieve Attachment Content

  • getContent()
    • Retrieves the raw byte array content of the attachment. Note that this may be the actual raw bytes of the attachment, or it may be the Base64 byte array representation. See the note above.
  • getContentString()
  • getContentString(charset)
    • Returns the content of the attachment as a string, using the specified charset encoding. If not specified, UTF-8 will be used. Note that this may be the raw string value of the attachment, or it may be the Base64 string value. See the note above.