Skip to content

TemplateControllerApi

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

Method HTTP request Description
createTemplate POST /templates Create a Template
deleteTemplate DELETE /templates/{templateId} Delete email template
getAllTemplates GET /templates/paginated List templates
getTemplate GET /templates/{templateId} Get template
getTemplates GET /templates List templates
updateTemplate PUT /templates/{templateId} Update template

TemplateDto createTemplate(createTemplateOptions)

Create a Template

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

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = TemplateControllerApi()
val createTemplateOptions : CreateTemplateOptions =  // CreateTemplateOptions | 
try {
    val result : TemplateDto = apiInstance.createTemplate(createTemplateOptions)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling TemplateControllerApi#createTemplate")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling TemplateControllerApi#createTemplate")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
createTemplateOptions CreateTemplateOptions

Return type

TemplateDto

Authorization

Configure API_KEY: ApiClient.apiKey["x-api-key"] = "" ApiClient.apiKeyPrefix["x-api-key"] = ""

HTTP request headers

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

deleteTemplate(templateId)

Delete email template

Delete template

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = TemplateControllerApi()
val templateId : java.util.UUID = 38400000-8cf0-11bd-b23e-10b96e4ef00d // java.util.UUID | Template ID
try {
    apiInstance.deleteTemplate(templateId)
} catch (e: ClientException) {
    println("4xx response calling TemplateControllerApi#deleteTemplate")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling TemplateControllerApi#deleteTemplate")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
templateId java.util.UUID Template ID

Return type

null (empty response body)

Authorization

Configure API_KEY: ApiClient.apiKey["x-api-key"] = "" ApiClient.apiKeyPrefix["x-api-key"] = ""

HTTP request headers

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

PageTemplateProjection getAllTemplates(page, size, sort, since, before)

List templates

Get all templates in paginated format

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = TemplateControllerApi()
val page : kotlin.Int = 56 // kotlin.Int | Optional page  in list pagination
val size : kotlin.Int = 56 // kotlin.Int | Optional page size in list pagination
val sort : kotlin.String = sort_example // kotlin.String | Optional createdAt sort direction ASC or DESC
val since : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime | Filter by created at after the given timestamp
val before : java.time.OffsetDateTime = 2013-10-20T19:20:30+01:00 // java.time.OffsetDateTime | Filter by created at before the given timestamp
try {
    val result : PageTemplateProjection = apiInstance.getAllTemplates(page, size, sort, since, before)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling TemplateControllerApi#getAllTemplates")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling TemplateControllerApi#getAllTemplates")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
page kotlin.Int Optional page in list pagination [optional] [default to 0]
size kotlin.Int Optional page size in list pagination [optional] [default to 20]
sort kotlin.String Optional createdAt sort direction ASC or DESC [optional] [default to ASC] [enum: ASC, DESC]
since java.time.OffsetDateTime Filter by created at after the given timestamp [optional]
before java.time.OffsetDateTime Filter by created at before the given timestamp [optional]

Return type

PageTemplateProjection

Authorization

Configure API_KEY: ApiClient.apiKey["x-api-key"] = "" ApiClient.apiKeyPrefix["x-api-key"] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

TemplateDto getTemplate(templateId)

Get template

Get email template

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = TemplateControllerApi()
val templateId : java.util.UUID = 38400000-8cf0-11bd-b23e-10b96e4ef00d // java.util.UUID | Template ID
try {
    val result : TemplateDto = apiInstance.getTemplate(templateId)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling TemplateControllerApi#getTemplate")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling TemplateControllerApi#getTemplate")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
templateId java.util.UUID Template ID

Return type

TemplateDto

Authorization

Configure API_KEY: ApiClient.apiKey["x-api-key"] = "" ApiClient.apiKeyPrefix["x-api-key"] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

kotlin.collections.List getTemplates()

List templates

Get all templates

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = TemplateControllerApi()
try {
    val result : kotlin.collections.List<TemplateProjection> = apiInstance.getTemplates()
    println(result)
} catch (e: ClientException) {
    println("4xx response calling TemplateControllerApi#getTemplates")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling TemplateControllerApi#getTemplates")
    e.printStackTrace()
}

Parameters

This endpoint does not need any parameter.

Return type

kotlin.collections.List

Authorization

Configure API_KEY: ApiClient.apiKey["x-api-key"] = "" ApiClient.apiKeyPrefix["x-api-key"] = ""

HTTP request headers

  • Content-Type: Not defined
  • Accept: /

TemplateDto updateTemplate(templateId, createTemplateOptions)

Update template

Update email template

Example

// Import classes:
//import com.mailslurp.infrastructure.*
//import com.mailslurp.models.*

val apiInstance = TemplateControllerApi()
val templateId : java.util.UUID = 38400000-8cf0-11bd-b23e-10b96e4ef00d // java.util.UUID | Template ID
val createTemplateOptions : CreateTemplateOptions =  // CreateTemplateOptions | 
try {
    val result : TemplateDto = apiInstance.updateTemplate(templateId, createTemplateOptions)
    println(result)
} catch (e: ClientException) {
    println("4xx response calling TemplateControllerApi#updateTemplate")
    e.printStackTrace()
} catch (e: ServerException) {
    println("5xx response calling TemplateControllerApi#updateTemplate")
    e.printStackTrace()
}

Parameters

Name Type Description Notes
templateId java.util.UUID Template ID
createTemplateOptions CreateTemplateOptions

Return type

TemplateDto

Authorization

Configure API_KEY: ApiClient.apiKey["x-api-key"] = "" ApiClient.apiKeyPrefix["x-api-key"] = ""

HTTP request headers

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