AttachmentControllerApi

All URIs are relative to https://api.mailslurp.com

MethodHTTP requestDescription
deleteAllAttachmentsDELETE /attachmentsDelete all attachments
deleteAttachmentDELETE /attachments/{attachmentId}Delete an attachment
downloadAttachmentAsBase64EncodedGET /attachments/{attachmentId}/base64Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
downloadAttachmentAsBytesGET /attachments/{attachmentId}/bytesDownload attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints.
getAttachmentGET /attachments/{attachmentId}Get an attachment entity
getAttachmentInfoGET /attachments/{attachmentId}/metadataGet email attachment metadata information
getAttachmentsGET /attachmentsGet email attachments
uploadAttachmentPOST /attachmentsUpload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
uploadAttachmentBytesPOST /attachments/bytesUpload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.
uploadMultipartFormPOST /attachments/multipartUpload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

deleteAllAttachments

deleteAllAttachments()

Delete all attachments

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
try {
    apiInstance.deleteAllAttachments()
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#deleteAllAttachments")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#deleteAllAttachments")
    e.printStackTrace()
}

Parameters

This endpoint does not need any parameter.

Return type

null (empty response body)

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

deleteAttachment

deleteAttachment(attachmentId)

Delete an attachment

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val attachmentId : kotlin.String = attachmentId_example // kotlin.String | ID of attachment
try {
    apiInstance.deleteAttachment(attachmentId)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#deleteAttachment")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#deleteAttachment")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
attachmentIdkotlin.StringID of attachment

Return type

null (empty response body)

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: Not defined

downloadAttachmentAsBase64Encoded

DownloadAttachmentDto downloadAttachmentAsBase64Encoded(attachmentId)

Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.

Returns the specified attachment for a given email as a base 64 encoded string. The response type is application/json. This method is similar to the downloadAttachment method but allows some clients to get around issues with binary responses.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val attachmentId : kotlin.String = attachmentId_example // kotlin.String | ID of attachment
try {
    val result : DownloadAttachmentDto = apiInstance.downloadAttachmentAsBase64Encoded(attachmentId)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#downloadAttachmentAsBase64Encoded")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#downloadAttachmentAsBase64Encoded")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
attachmentIdkotlin.StringID of attachment

Return type

DownloadAttachmentDto

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

downloadAttachmentAsBytes

kotlin.ByteArray downloadAttachmentAsBytes(attachmentId)

Download attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints.

Returns the specified attachment for a given email as a stream / array of bytes. You can find attachment ids in email responses endpoint responses. The response type is application/octet-stream.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val attachmentId : kotlin.String = attachmentId_example // kotlin.String | ID of attachment
try {
    val result : kotlin.ByteArray = apiInstance.downloadAttachmentAsBytes(attachmentId)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#downloadAttachmentAsBytes")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#downloadAttachmentAsBytes")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
attachmentIdkotlin.StringID of attachment

Return type

kotlin.ByteArray

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/octet-stream

getAttachment

AttachmentEntity getAttachment(attachmentId)

Get an attachment entity

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val attachmentId : kotlin.String = attachmentId_example // kotlin.String | ID of attachment
try {
    val result : AttachmentEntity = apiInstance.getAttachment(attachmentId)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#getAttachment")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#getAttachment")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
attachmentIdkotlin.StringID of attachment

Return type

AttachmentEntity

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getAttachmentInfo

AttachmentMetaData getAttachmentInfo(attachmentId)

Get email attachment metadata information

Returns the metadata for an attachment. It is saved separately to the content of the attachment. Contains properties name and content-type and content-length in bytes for a given attachment.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val attachmentId : kotlin.String = attachmentId_example // kotlin.String | ID of attachment
try {
    val result : AttachmentMetaData = apiInstance.getAttachmentInfo(attachmentId)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#getAttachmentInfo")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#getAttachmentInfo")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
attachmentIdkotlin.StringID of attachment

Return type

AttachmentMetaData

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

getAttachments

PageAttachmentEntity getAttachments(before, fileNameFilter, page, since, size, sort)

Get email attachments

Get all attachments in paginated response. Each entity contains meta data for the attachment such as name and content-type. Use the attachmentId and the download endpoints to get the file contents.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val before : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime | Filter by created at before the given timestamp
val fileNameFilter : kotlin.String = fileNameFilter_example // kotlin.String | Optional file name and content type search filter
val page : kotlin.Int = 56 // kotlin.Int | Optional page  event list pagination
val since : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime | Filter by created at after the given timestamp
val size : kotlin.Int = 56 // kotlin.Int | Optional page size event list pagination
val sort : kotlin.String = sort_example // kotlin.String | Optional createdAt sort direction ASC or DESC
try {
    val result : PageAttachmentEntity = apiInstance.getAttachments(before, fileNameFilter, page, since, size, sort)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#getAttachments")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#getAttachments")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
beforejava.time.OffsetDateTimeFilter by created at before the given timestamp[optional]
fileNameFilterkotlin.StringOptional file name and content type search filter[optional]
pagekotlin.IntOptional page event list pagination[optional] [default to 0]
sincejava.time.OffsetDateTimeFilter by created at after the given timestamp[optional]
sizekotlin.IntOptional page size event list pagination[optional] [default to 20]
sortkotlin.StringOptional createdAt sort direction ASC or DESC[optional] [default to ASC] [enum: ASC, DESC]

Return type

PageAttachmentEntity

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

uploadAttachment

kotlin.collections.List<kotlin.String> uploadAttachment(uploadOptions)

Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val uploadOptions : UploadAttachmentOptions =  // UploadAttachmentOptions | uploadOptions
try {
    val result : kotlin.collections.List<kotlin.String> = apiInstance.uploadAttachment(uploadOptions)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#uploadAttachment")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#uploadAttachment")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
uploadOptionsUploadAttachmentOptionsuploadOptions

Return type

kotlin.collections.List<kotlin.String>

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

uploadAttachmentBytes

kotlin.collections.List<kotlin.String> uploadAttachmentBytes(contentType, filename, byteArray)

Upload an attachment for sending using file byte stream input octet stream. Returns an array whose first element is the ID of the uploaded attachment.

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val contentType : kotlin.String = contentType_example // kotlin.String | Optional contentType for file. For instance `application/pdf`
val filename : kotlin.String = filename_example // kotlin.String | Optional filename to save upload with
val byteArray : kotlin.ByteArray = BYTE_ARRAY_DATA_HERE // kotlin.ByteArray | Byte array request body
try {
    val result : kotlin.collections.List<kotlin.String> = apiInstance.uploadAttachmentBytes(contentType, filename, byteArray)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#uploadAttachmentBytes")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#uploadAttachmentBytes")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
contentTypekotlin.StringOptional contentType for file. For instance application/pdf[optional]
filenamekotlin.StringOptional filename to save upload with[optional]
byteArraykotlin.ByteArrayByte array request body[optional]

Return type

kotlin.collections.List<kotlin.String>

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: application/octet-stream
  • Accept: application/json

uploadMultipartForm

kotlin.collections.List<kotlin.String> uploadMultipartForm(file, contentType, filename, xFilename)

Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

Email attachments are essentially files with meta data. Files are byte arrays and the meta data is a content type and a filename. These properties allow email clients to display the filename and icon etc. When sending emails with attachments first upload each attachment with an upload endpoint. Record the returned attachment ID and use it with subsequent email sending. For legacy reasons the ID is returned as the first element in an array. Only a single ID is ever returned. To send the attachments pass a list of attachment IDs with SendEmailOptions when sending an email. Using the upload endpoints prior to sending mean attachments can easily be reused.

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = AttachmentControllerApi()
val file : java.io.File = BINARY_DATA_HERE // java.io.File | file
val contentType : kotlin.String = contentType_example // kotlin.String | Optional content type of attachment
val filename : kotlin.String = filename_example // kotlin.String | Optional name of file
val xFilename : kotlin.String = xFilename_example // kotlin.String | Optional content type header of attachment
try {
    val result : kotlin.collections.List<kotlin.String> = apiInstance.uploadMultipartForm(file, contentType, filename, xFilename)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling AttachmentControllerApi#uploadMultipartForm")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling AttachmentControllerApi#uploadMultipartForm")
    e.printStackTrace()
}

Parameters

NameTypeDescriptionNotes
filejava.io.Filefile
contentTypekotlin.StringOptional content type of attachment[optional]
filenamekotlin.StringOptional name of file[optional]
xFilenamekotlin.StringOptional content type header of attachment[optional]

Return type

kotlin.collections.List<kotlin.String>

Authorization

Configure API_KEY: ApiClient.apiKey[“x-api-key”] = "" ApiClient.apiKeyPrefix[“x-api-key”] = ""

HTTP request headers

  • Content-Type: multipart/form-data
  • Accept: application/json