The Basics
Working with the /templates
endpoint is a two steps process:
Send your named template to the service:
POST {{host}}/templates?templateName=Freemarker.HelloWorld ...template...
Render your data with reference to the name of the template
POST {{host}}/templates/render?templateName=Freemarker.HelloWorld
{ "UserName" : "Markus Schmidt" }
Templates are persisted. To manage your templates you can use the Get, Query, Upsert and Delete functions on the /template
endpoint (see OpenAPI Description). Once a template is available (posted) you can use it with as many datasets you want, to /templates/render
documents.
Be aware:
If you use the SharedAccount to manage your templates, you are "sharing" your templates with other users on the same (public) account. Everyone can read or modify your templates, or, if someone else uses the same template name, he might "highjack" your template content. It is recommended to add {company name}.
in front of the name of your template name, for example: MSPro
.Invoice.EMail
.
Alternatively, you can get a dedicated account, where your information is no longer shared.
Example
POST {{host}}/templates?templateName=Freemarker.HelloWorld
Content-Type: text/plain
Authorization: Basic {{basicToken}}
Hello ${UserName}!
Welcome to the Freemarker render engine.
###
POST {{host}}/templates/render?templateName=Freemarker.HelloWorld
Content-Type: application/json
Accept: text/plain
Authorization: Basic {{basicToken}}
{
"UserName" : "Lisa Mueller"
}
###
POST {{host}}/templates/render?templateName=Freemarker.HelloWorld
Content-Type: application/json
Accept: text/plain
Authorization: Basic {{basicToken}}
Hello Markus Schmidt!
Welcome to the Freemarker render engine.
Last updated