Ajouter un template

Post /settings/templates

Paramètres :

Nom Description Type Obligatoire
description Description du template String Oui
from
Nom Description Type Obligatoire
address Adresse email String Oui
personalName Nom String Oui
Struct Oui
htmlContent Contenu Html String Oui
textContent Contenu texte String Oui

Réponse :

Nom Description Type
templates
id Id du template String
templateName Nom du template String
description Description du template String
from
Nom Description Type
address Adresse email String
personalName Nom String
Struct
htmlContent Contenu Html String
textContent Contenu texte String
createdAt Date au format timestamp Int
updatedAt Date au format timestamp Int
Struct
Langage de programmation :

Exemple de requête :

							{
								"description": "description du template",
								"from": {
									"address": "from@example.com",
									"personalName": "Sender name"
								},
								"subject": "Message subject",
								"htmlContent": "html content",
								"textContent": "text content"
							}
							

Exemple de réponse :

							{
								"id": "g65r4g64h65tr47h678th11d",
								"templateName": "description-du-template",
								"description": "Description du template",
								"from": {
									"address": "from@example.com"
									"personalName": "Sender name"
								},
								"subject": "Message subject",
								"htmlContent": "html content",
								"textContent": "text content",
								"createdAt": 1447938089,
								"updatedAt": 1447938089
							}
							

Exemple de code :

								curl -X POST -d '{"description":"description du template","from":{"address":"from@example.com","personalName":"Sender name"},"subject":"Message subject","htmlContent":"html content","textContent":"text content"}' -H "Content-Type: application/json" -H "X-Tipimail-ApiUser:YOUR_SMTP_USERNAME" -H "X-Tipimail-ApiKey:YOUR_SMTP_KEY" https://api.tipimail.com/v1/settings/templates
							
require 'vendor/autoload.php';

$tipimail = new Tipimail\Tipimail('YOUR_SMTP_USERNAME', 'YOUR_API_KEY');

try {
	
	$description = 'Description';
	$fromAddress = 'from@example.com';
	$fromPersonalName = 'From Personal Name';
	$subject = 'Subject';
	$htmlContent = 'html content';
	$textContent = 'text content';
	$result = $tipimail->getSettingsService()->getTemplatesService()->add($description, $fromAddress, $fromPersonalName, $subject, $htmlContent, $textContent);
	var_dump($result);
		
}
catch(Tipimail\Exceptions\TipimailException $e) {
	echo 'Exception received :', $e->getMessage(), "\n";
	
}