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);
}
}
}
}
Using the DeleteAllAttachmentsWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Delete all attachments
apiInstance.DeleteAllAttachmentsWithHttpInfo();
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.DeleteAllAttachmentsWithHttpInfo: " + 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
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);
}
}
}
}
Using the DeleteAttachmentWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Delete an attachment
apiInstance.DeleteAttachmentWithHttpInfo(attachmentId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.DeleteAttachmentWithHttpInfo: " + 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
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);
}
}
}
}
Using the DownloadAttachmentAsBase64EncodedWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Get email attachment as base64 encoded string as alternative to binary responses. To read the content decode the Base64 encoded contents.
ApiResponse<DownloadAttachmentDto> response = apiInstance.DownloadAttachmentAsBase64EncodedWithHttpInfo(attachmentId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.DownloadAttachmentAsBase64EncodedWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachmentId | string | ID of attachment |
Return type
Authorization
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);
}
}
}
}
Using the DownloadAttachmentAsBytesWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Download attachments. Get email attachment bytes. If you have trouble with byte responses try the `downloadAttachmentBase64` response endpoints.
ApiResponse<byte[]> response = apiInstance.DownloadAttachmentAsBytesWithHttpInfo(attachmentId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.DownloadAttachmentAsBytesWithHttpInfo: " + 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
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);
}
}
}
}
Using the GetAttachmentWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Get an attachment entity
ApiResponse<AttachmentEntity> response = apiInstance.GetAttachmentWithHttpInfo(attachmentId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.GetAttachmentWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachmentId | string | ID of attachment |
Return type
Authorization
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);
}
}
}
}
Using the GetAttachmentInfoWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Get email attachment metadata information
ApiResponse<AttachmentMetaData> response = apiInstance.GetAttachmentInfoWithHttpInfo(attachmentId);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.GetAttachmentInfoWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
attachmentId | string | ID of attachment |
Return type
Authorization
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 = 0; // int? | Optional page for list pagination (optional) (default to 0)
var size = 20; // int? | Optional page size for list pagination (optional) (default to 20)
var sort = "ASC"; // 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 = DateTime.Parse("2013-10-20T19:20:30+01:00"); // DateTime? | Filter by created at after the given timestamp (optional)
var before = DateTime.Parse("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);
}
}
}
}
Using the GetAttachmentsWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Get email attachments
ApiResponse<PageAttachmentEntity> response = apiInstance.GetAttachmentsWithHttpInfo(page, size, sort, fileNameFilter, since, before);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.GetAttachmentsWithHttpInfo: " + 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
Authorization
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);
}
}
}
}
Using the UploadAttachmentWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Upload an attachment for sending using base64 file encoding. Returns an array whose first element is the ID of the uploaded attachment.
ApiResponse<List<string>> response = apiInstance.UploadAttachmentWithHttpInfo(uploadAttachmentOptions);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.UploadAttachmentWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
uploadAttachmentOptions | UploadAttachmentOptions |
Return type
List
Authorization
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 (UploadAttachmentBytesRequest uploadAttachmentBytesRequest, 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 uploadAttachmentBytesRequest = new UploadAttachmentBytesRequest(); // UploadAttachmentBytesRequest |
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(uploadAttachmentBytesRequest, 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);
}
}
}
}
Using the UploadAttachmentBytesWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
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.
ApiResponse<List<string>> response = apiInstance.UploadAttachmentBytesWithHttpInfo(uploadAttachmentBytesRequest, contentType, filename);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.UploadAttachmentBytesWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
Name | Type | Description | Notes |
---|---|---|---|
uploadAttachmentBytesRequest | UploadAttachmentBytesRequest | ||
contentType | string | Optional contentType for file. For instance application/pdf | [optional] |
filename | string | Optional filename to save upload with | [optional] |
Return type
List
Authorization
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, UploadMultipartFormRequest uploadMultipartFormRequest = 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 uploadMultipartFormRequest = new UploadMultipartFormRequest(); // UploadMultipartFormRequest | (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, uploadMultipartFormRequest);
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);
}
}
}
}
Using the UploadMultipartFormWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Upload an attachment for sending using a Multipart Form request. Returns an array whose first element is the ID of the uploaded attachment.
ApiResponse<List<string>> response = apiInstance.UploadMultipartFormWithHttpInfo(contentType, filename, xFilename, uploadMultipartFormRequest);
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AttachmentControllerApi.UploadMultipartFormWithHttpInfo: " + 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] |
uploadMultipartFormRequest | UploadMultipartFormRequest | [optional] |
Return type
List
Authorization
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 ]