Skip to content

mailslurp_netstandard_2x.Api.AttachmentControllerApi

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

Method HTTP request Description
DeleteAllAttachments DELETE /attachments Delete all attachments
DeleteAttachment DELETE /attachments/{attachmentId} Delete an attachment
DownloadAttachmentAsBase64Encoded 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.
DownloadAttachmentAsBytes GET /attachments/{attachmentId}/bytes Download attachments. Get email attachment bytes. If you have trouble with byte responses try the downloadAttachmentBase64 response endpoints.
GetAttachment GET /attachments/{attachmentId} Get an attachment entity
GetAttachmentInfo GET /attachments/{attachmentId}/metadata Get email attachment metadata information
GetAttachments GET /attachments Get email attachments
UploadAttachment POST /attachments Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
UploadAttachmentBytes 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.
UploadMultipartForm 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.

void DeleteAllAttachments ()

Delete all attachments

Example

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class DeleteAllAttachmentsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);

            try
            {
                // Delete all attachments
                apiInstance.DeleteAllAttachments();
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.DeleteAllAttachments: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

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

HTTP response details

Status code Description Response headers
204 No Content -

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

void DeleteAttachment (string attachmentId)

Delete an attachment

Example

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class DeleteAttachmentExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var attachmentId = attachmentId_example;  // string | ID of attachment

            try
            {
                // Delete an attachment
                apiInstance.DeleteAttachment(attachmentId);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.DeleteAttachment: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
attachmentId string ID of attachment

Return type

void (empty response body)

Authorization

API_KEY

HTTP request headers

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

HTTP response details

Status code Description Response headers
204 No Content -

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

DownloadAttachmentDto DownloadAttachmentAsBase64Encoded (string 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

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class DownloadAttachmentAsBase64EncodedExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var attachmentId = attachmentId_example;  // string | ID of attachment

            try
            {
                // Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
                DownloadAttachmentDto result = apiInstance.DownloadAttachmentAsBase64Encoded(attachmentId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.DownloadAttachmentAsBase64Encoded: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
attachmentId string ID of attachment

Return type

DownloadAttachmentDto

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 OK -

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

byte[] DownloadAttachmentAsBytes (string 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

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class DownloadAttachmentAsBytesExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var attachmentId = attachmentId_example;  // string | ID of attachment

            try
            {
                // Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
                byte[] result = apiInstance.DownloadAttachmentAsBytes(attachmentId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.DownloadAttachmentAsBytes: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
attachmentId string ID of attachment

Return type

byte[]

Authorization

API_KEY

HTTP request headers

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

HTTP response details

Status code Description Response headers
0 default response -

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

AttachmentEntity GetAttachment (string attachmentId)

Get an attachment entity

Example

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class GetAttachmentExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var attachmentId = attachmentId_example;  // string | ID of attachment

            try
            {
                // Get an attachment entity
                AttachmentEntity result = apiInstance.GetAttachment(attachmentId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.GetAttachment: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
attachmentId string ID of attachment

Return type

AttachmentEntity

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 OK -

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

AttachmentMetaData GetAttachmentInfo (string 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

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class GetAttachmentInfoExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var attachmentId = attachmentId_example;  // string | ID of attachment

            try
            {
                // Get email attachment metadata information
                AttachmentMetaData result = apiInstance.GetAttachmentInfo(attachmentId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.GetAttachmentInfo: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
attachmentId string ID of attachment

Return type

AttachmentMetaData

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 OK -

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

PageAttachmentEntity GetAttachments (int? page = null, int? size = null, string sort = null, string fileNameFilter = null, DateTime? since = null, DateTime? before = null)

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

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class GetAttachmentsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var page = 56;  // int? | Optional page  for list pagination (optional)  (default to 0)
            var size = 56;  // int? | Optional page size for list pagination (optional)  (default to 20)
            var sort = sort_example;  // string | Optional createdAt sort direction ASC or DESC (optional)  (default to ASC)
            var fileNameFilter = fileNameFilter_example;  // string | Optional file name and content type search filter (optional) 
            var since = 2013-10-20T19:20:30+01:00;  // DateTime? | Filter by created at after the given timestamp (optional) 
            var before = 2013-10-20T19:20:30+01:00;  // DateTime? | Filter by created at before the given timestamp (optional) 

            try
            {
                // Get email attachments
                PageAttachmentEntity result = apiInstance.GetAttachments(page, size, sort, fileNameFilter, since, before);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.GetAttachments: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
page int? Optional page for list pagination [optional] [default to 0]
size int? Optional page size for list pagination [optional] [default to 20]
sort string Optional createdAt sort direction ASC or DESC [optional] [default to ASC]
fileNameFilter string Optional file name and content type search filter [optional]
since DateTime? Filter by created at after the given timestamp [optional]
before DateTime? Filter by created at before the given timestamp [optional]

Return type

PageAttachmentEntity

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

HTTP response details

Status code Description Response headers
200 OK -

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

List UploadAttachment (UploadAttachmentOptions uploadAttachmentOptions)

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

Example

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class UploadAttachmentExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var uploadAttachmentOptions = new UploadAttachmentOptions(); // UploadAttachmentOptions | 

            try
            {
                // Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
                List<string> result = apiInstance.UploadAttachment(uploadAttachmentOptions);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.UploadAttachment: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
uploadAttachmentOptions UploadAttachmentOptions

Return type

List

Authorization

API_KEY

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Created -

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

List UploadAttachmentBytes (InlineObject1 inlineObject1, string contentType = null, string filename = null)

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.

Example

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class UploadAttachmentBytesExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var inlineObject1 = new InlineObject1(); // InlineObject1 | 
            var contentType = contentType_example;  // string | Optional contentType for file. For instance `application/pdf` (optional) 
            var filename = filename_example;  // string | Optional filename to save upload with (optional) 

            try
            {
                // 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.
                List<string> result = apiInstance.UploadAttachmentBytes(inlineObject1, contentType, filename);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.UploadAttachmentBytes: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
inlineObject1 InlineObject1
contentType string Optional contentType for file. For instance application/pdf [optional]
filename string Optional filename to save upload with [optional]

Return type

List

Authorization

API_KEY

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Created -

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

List UploadMultipartForm (string contentType = null, string filename = null, string xFilename = null, InlineObject inlineObject = null)

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

Example

using System.Collections.Generic;
using System.Diagnostics;
using mailslurp_netstandard_2x.Api;
using mailslurp_netstandard_2x.Client;
using mailslurp_netstandard_2x.Model;

namespace Example
{
    public class UploadMultipartFormExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://csharp.api.mailslurp.com";
            // Configure API key authorization: API_KEY
            config.AddApiKey("x-api-key", "YOUR_API_KEY");
            // Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
            // config.AddApiKeyPrefix("x-api-key", "Bearer");

            var apiInstance = new AttachmentControllerApi(config);
            var contentType = contentType_example;  // string | Optional content type of attachment (optional) 
            var filename = filename_example;  // string | Optional name of file (optional) 
            var xFilename = xFilename_example;  // string | Optional content type header of attachment (optional) 
            var inlineObject = new InlineObject(); // InlineObject |  (optional) 

            try
            {
                // Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
                List<string> result = apiInstance.UploadMultipartForm(contentType, filename, xFilename, inlineObject);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling AttachmentControllerApi.UploadMultipartForm: " + e.Message );
                Debug.Print("Status Code: "+ e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Parameters

Name Type Description Notes
contentType string Optional content type of attachment [optional]
filename string Optional name of file [optional]
xFilename string Optional content type header of attachment [optional]
inlineObject InlineObject [optional]

Return type

List

Authorization

API_KEY

HTTP request headers

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

HTTP response details

Status code Description Response headers
201 Created -

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