maislurp-client-powershell.maislurp-client-powershell/Api.AttachmentControllerApi

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

MethodHTTP requestDescription
Invoke-DeleteAllAttachmentsDELETE /attachmentsDelete all attachments
Invoke-DeleteAttachmentDELETE /attachments/{attachmentId}Delete an attachment
Invoke-DownloadAttachmentAsBase64EncodedGET /attachments/{attachmentId}/base64Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
Invoke-DownloadAttachmentAsBytesGET /attachments/{attachmentId}/bytesDownload attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints.
Get-AttachmentGET /attachments/{attachmentId}Get an attachment entity
Get-AttachmentInfoGET /attachments/{attachmentId}/metadataGet email attachment metadata information
Get-AttachmentsGET /attachmentsGet email attachments
Invoke-UploadAttachmentPOST /attachmentsUpload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
Invoke-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.
Invoke-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.

Invoke-DeleteAllAttachments

void Invoke-DeleteAllAttachments

Delete all attachments

Example

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"


# Delete all attachments
try {
     $Result = Invoke-DeleteAllAttachments
} catch {
    Write-Host ("Exception occured when calling Invoke-DeleteAllAttachments: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

This endpoint does not need any parameter.

Return type

void (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 ]

Invoke-DeleteAttachment

void Invoke-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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$AttachmentId = "AttachmentId_example" # String | ID of attachment

# Delete an attachment
try {
     $Result = Invoke-DeleteAttachment -AttachmentId $AttachmentId
} catch {
    Write-Host ("Exception occured when calling Invoke-DeleteAttachment: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
AttachmentIdStringID of attachment

Return type

void (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 ]

Invoke-DownloadAttachmentAsBase64Encoded

DownloadAttachmentDto Invoke-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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$AttachmentId = "AttachmentId_example" # String | ID of attachment

# Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
try {
     $Result = Invoke-DownloadAttachmentAsBase64Encoded -AttachmentId $AttachmentId
} catch {
    Write-Host ("Exception occured when calling Invoke-DownloadAttachmentAsBase64Encoded: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
AttachmentIdStringID of attachment

Return type

DownloadAttachmentDto (PSCustomObject)

Authorization

API_KEY

HTTP request headers

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

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

Invoke-DownloadAttachmentAsBytes

SystemByte Invoke-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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$AttachmentId = "AttachmentId_example" # String | ID of attachment

# Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
try {
     $Result = Invoke-DownloadAttachmentAsBytes -AttachmentId $AttachmentId
} catch {
    Write-Host ("Exception occured when calling Invoke-DownloadAttachmentAsBytes: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
AttachmentIdStringID of attachment

Return type

SystemByte (PSCustomObject)

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

AttachmentEntity Get-Attachment         [-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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$AttachmentId = "AttachmentId_example" # String | ID of attachment

# Get an attachment entity
try {
     $Result = Get-Attachment -AttachmentId $AttachmentId
} catch {
    Write-Host ("Exception occured when calling Get-Attachment: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
AttachmentIdStringID of attachment

Return type

AttachmentEntity (PSCustomObject)

Authorization

API_KEY

HTTP request headers

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

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

Get-AttachmentInfo

AttachmentMetaData Get-AttachmentInfo         [-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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$AttachmentId = "AttachmentId_example" # String | ID of attachment

# Get email attachment metadata information
try {
     $Result = Get-AttachmentInfo -AttachmentId $AttachmentId
} catch {
    Write-Host ("Exception occured when calling Get-AttachmentInfo: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
AttachmentIdStringID of attachment

Return type

AttachmentMetaData (PSCustomObject)

Authorization

API_KEY

HTTP request headers

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

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

Get-Attachments

PageAttachmentEntity Get-Attachments         [-Before] <System.Nullable[System.DateTime]>         [-FileNameFilter]         [-Page] <System.Nullable[Int32]>         [-Since] <System.Nullable[System.DateTime]>         [-Size] <System.Nullable[Int32]>         [-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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$Before = Get-Date # System.DateTime | Filter by created at before the given timestamp (optional)
$FileNameFilter = "FileNameFilter_example" # String | Optional file name and content type search filter (optional)
$Page = 987 # Int32 | Optional page  event list pagination (optional) (default to 0)
$Since = Get-Date # System.DateTime | Filter by created at after the given timestamp (optional)
$Size = 987 # Int32 | Optional page size event list pagination (optional) (default to 20)
$Sort = "ASC" # String | Optional createdAt sort direction ASC or DESC (optional) (default to "ASC")

# Get email attachments
try {
     $Result = Get-Attachments -Before $Before -FileNameFilter $FileNameFilter -Page $Page -Since $Since -Size $Size -Sort $Sort
} catch {
    Write-Host ("Exception occured when calling Get-Attachments: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
BeforeSystem.DateTimeFilter by created at before the given timestamp[optional]
FileNameFilterStringOptional file name and content type search filter[optional]
PageInt32Optional page event list pagination[optional] [default to 0]
SinceSystem.DateTimeFilter by created at after the given timestamp[optional]
SizeInt32Optional page size event list pagination[optional] [default to 20]
SortStringOptional createdAt sort direction ASC or DESC[optional] [default to “ASC”]

Return type

PageAttachmentEntity (PSCustomObject)

Authorization

API_KEY

HTTP request headers

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

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

Invoke-UploadAttachment

String[] Invoke-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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$UploadOptions = (Initialize-UploadAttachmentOptions -Base64Contents "Base64Contents_example" -ContentType "ContentType_example" -Filename "Filename_example") # UploadAttachmentOptions | uploadOptions

# Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
try {
     $Result = Invoke-UploadAttachment -UploadOptions $UploadOptions
} catch {
    Write-Host ("Exception occured when calling Invoke-UploadAttachment: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
UploadOptionsUploadAttachmentOptionsuploadOptions

Return type

String[]

Authorization

API_KEY

HTTP request headers

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

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

Invoke-UploadAttachmentBytes

String[] Invoke-UploadAttachmentBytes         [-ContentType]         [-Filename]         [-ByteArray] <System.Nullable[SystemByte]>

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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$ContentType = "ContentType_example" # String | Optional contentType for file. For instance `application/pdf` (optional)
$Filename = "Filename_example" # String | Optional filename to save upload with (optional)
$ByteArray = TODO # SystemByte | Byte array request body (optional)

# 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.
try {
     $Result = Invoke-UploadAttachmentBytes -ContentType $ContentType -Filename $Filename -ByteArray $ByteArray
} catch {
    Write-Host ("Exception occured when calling Invoke-UploadAttachmentBytes: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
ContentTypeStringOptional contentType for file. For instance application/pdf[optional]
FilenameStringOptional filename to save upload with[optional]
ByteArraySystemByteByte array request body[optional]

Return type

String[]

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 ]

Invoke-UploadMultipartForm

String[] Invoke-UploadMultipartForm         [-File] <System.IO.FileInfo>         [-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

# general setting of the PowerShell module, e.g. base URL, authentication, etc
$Configuration = Get-Configuration
# Configure API key authorization: API_KEY
$Configuration.ApiKey.x-api-key = "YOUR_API_KEY"
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
#$Configuration.ApiKeyPrefix.x-api-key = "Bearer"

$File = 987 # System.IO.FileInfo | file
$ContentType = "ContentType_example" # String | Optional content type of attachment (optional)
$Filename = "Filename_example" # String | Optional name of file (optional)
$XFilename = "XFilename_example" # String | Optional content type header of attachment (optional)

# Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
try {
     $Result = Invoke-UploadMultipartForm -File $File -ContentType $ContentType -Filename $Filename -XFilename $XFilename
} catch {
    Write-Host ("Exception occured when calling Invoke-UploadMultipartForm: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

NameTypeDescriptionNotes
FileSystem.IO.FileInfo****System.IO.FileInfofile
ContentTypeStringOptional content type of attachment[optional]
FilenameStringOptional name of file[optional]
XFilenameStringOptional content type header of attachment[optional]

Return type

String[]

Authorization

API_KEY

HTTP request headers

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

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