Skip to content

maislurp-client-powershell.maislurp-client-powershell/Api.TemplateControllerApi

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

Method HTTP request Description
New-Template POST /templates Create a Template
Invoke-DeleteTemplate DELETE /templates/{templateId} Delete email template
Get-AllTemplates GET /templates/paginated List templates
Get-Template GET /templates/{templateId} Get template
Get-Templates GET /templates List templates
Update-Template PUT /templates/{templateId} Update template

TemplateDto New-Template
        [-CreateTemplateOptions]

Create a Template

Create an email template with variables for use with templated transactional emails.

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"

$CreateTemplateOptions = (Initialize-CreateTemplateOptions -Name "Name_example" -Content "Content_example") # CreateTemplateOptions | 

# Create a Template
try {
     $Result = New-Template -CreateTemplateOptions $CreateTemplateOptions
} catch {
    Write-Host ("Exception occured when calling New-Template: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

Name Type Description Notes
CreateTemplateOptions CreateTemplateOptions

Return type

TemplateDto (PSCustomObject)

Authorization

API_KEY

HTTP request headers

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

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

void Invoke-DeleteTemplate
        [-TemplateId]

Delete email template

Delete template

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"

$TemplateId = "TemplateId_example" # String | Template ID

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

Parameters

Name Type Description Notes
TemplateId String Template ID

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 ]

PageTemplateProjection Get-AllTemplates
        [-Page]
        [-Size]
        [-Sort]
        [-Since]
        [-Before]

List templates

Get all templates in paginated format

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"

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

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

Parameters

Name Type Description Notes
Page Int32 Optional page in list pagination [optional] [default to 0]
Size Int32 Optional page size in list pagination [optional] [default to 20]
Sort String Optional createdAt sort direction ASC or DESC [optional] [default to "ASC"]
Since System.DateTime Filter by created at after the given timestamp [optional]
Before System.DateTime Filter by created at before the given timestamp [optional]

Return type

PageTemplateProjection (PSCustomObject)

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

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

TemplateDto Get-Template
        [-TemplateId]

Get template

Get email template

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"

$TemplateId = "TemplateId_example" # String | Template ID

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

Parameters

Name Type Description Notes
TemplateId String Template ID

Return type

TemplateDto (PSCustomObject)

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

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

TemplateProjection[] Get-Templates

List templates

Get all templates

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"


# List templates
try {
     $Result = Get-Templates
} catch {
    Write-Host ("Exception occured when calling Get-Templates: {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

TemplateProjection[] (PSCustomObject)

Authorization

API_KEY

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

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

TemplateDto Update-Template
        [-TemplateId]
        [-CreateTemplateOptions]

Update template

Update email template

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"

$TemplateId = "TemplateId_example" # String | Template ID
$CreateTemplateOptions = (Initialize-CreateTemplateOptions -Name "Name_example" -Content "Content_example") # CreateTemplateOptions | 

# Update template
try {
     $Result = Update-Template -TemplateId $TemplateId -CreateTemplateOptions $CreateTemplateOptions
} catch {
    Write-Host ("Exception occured when calling Update-Template: {0}" -f ($_.ErrorDetails | ConvertFrom-Json))
    Write-Host ("Response headers: {0}" -f ($_.Exception.Response.Headers | ConvertTo-Json))
}

Parameters

Name Type Description Notes
TemplateId String Template ID
CreateTemplateOptions CreateTemplateOptions

Return type

TemplateDto (PSCustomObject)

Authorization

API_KEY

HTTP request headers

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

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