Skip to content

\AttachmentControllerApi

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

Method HTTP request Description
delete_all_attachments delete /attachments Delete all attachments
delete_attachment delete /attachments/{attachmentId} Delete an attachment
download_attachment_as_base64_encoded get /attachments/{attachmentId}/base64 Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
download_attachment_as_bytes get /attachments/{attachmentId}/bytes Download attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints.
get_attachment get /attachments/{attachmentId} Get an attachment entity
get_attachment_info get /attachments/{attachmentId}/metadata Get email attachment metadata information
get_attachments get /attachments Get email attachments
upload_attachment post /attachments Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
upload_attachment_bytes post /attachments/bytes 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.
upload_multipart_form post /attachments/multipart Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

delete_all_attachments

delete_all_attachments() Delete all attachments

Parameters

This endpoint does not need any parameter.

Return type

(empty response body)

Authorization

API_KEY

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to ]

delete_attachment

delete_attachment(attachment_id) Delete an attachment

Parameters

Name Type Description Required Notes
attachment_id String ID of attachment [required]

Return type

(empty response body)

Authorization

API_KEY

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to ]

download_attachment_as_base64_encoded

crate::models::DownloadAttachmentDto download_attachment_as_base64_encoded(attachment_id) 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.

Parameters

Name Type Description Required Notes
attachment_id String ID of attachment [required]

Return type

crate::models::DownloadAttachmentDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

[Back to top] [Back to API list] [Back to Model list] [Back to ]

download_attachment_as_bytes

String download_attachment_as_bytes(attachment_id) 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.

Parameters

Name Type Description Required Notes
attachment_id String ID of attachment [required]

Return type

String

Authorization

API_KEY

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to ]

get_attachment

crate::models::AttachmentEntity get_attachment(attachment_id) Get an attachment entity

Parameters

Name Type Description Required Notes
attachment_id String ID of attachment [required]

Return type

crate::models::AttachmentEntity

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

[Back to top] [Back to API list] [Back to Model list] [Back to ]

get_attachment_info

crate::models::AttachmentMetaData get_attachment_info(attachment_id) 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.

Parameters

Name Type Description Required Notes
attachment_id String ID of attachment [required]

Return type

crate::models::AttachmentMetaData

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

[Back to top] [Back to API list] [Back to Model list] [Back to ]

get_attachments

crate::models::PageAttachmentEntity get_attachments(page, size, sort, file_name_filter, since, before) 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.

Parameters

Name Type Description Required Notes
page Option<i32> Optional page for list pagination [default to 0]
size Option<i32> Optional page size for list pagination [default to 20]
sort Option<String> Optional createdAt sort direction ASC or DESC [default to ASC]
file_name_filter Option<String> Optional file name and content type search filter
since Option<String> Filter by created at after the given timestamp
before Option<String> Filter by created at before the given timestamp

Return type

crate::models::PageAttachmentEntity

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

[Back to top] [Back to API list] [Back to Model list] [Back to ]

upload_attachment

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

Parameters

Name Type Description Required Notes
upload_attachment_options UploadAttachmentOptions [required]

Return type

Vec

Authorization

API_KEY

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to ]

upload_attachment_bytes

Vec upload_attachment_bytes(inline_object1, content_type, filename) 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.

Parameters

Name Type Description Required Notes
inline_object1 InlineObject1 [required]
content_type Option<String> Optional contentType for file. For instance application/pdf
filename Option<String> Optional filename to save upload with

Return type

Vec

Authorization

API_KEY

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to ]

upload_multipart_form

Vec upload_multipart_form(content_type, filename, x_filename, inline_object) Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.

Parameters

Name Type Description Required Notes
content_type Option<String> Optional content type of attachment
filename Option<String> Optional name of file
x_filename Option<String> Optional content type header of attachment
inline_object Option<InlineObject>

Return type

Vec

Authorization

API_KEY

HTTP request headers

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

[Back to top] [Back to API list] [Back to Model list] [Back to ]