Using a template is convenient, when you have reusable content that you want to save for multiple sendings. You need to create the template beforehand with a POST on /template , or by using our drag-and-drop Email Editor builder in the Mailjet app.
The template can be personalized using contact properties, depending on your needs.
Once the template is created, do a PUT on /campaigndraft to link the template ID to your draft.
When the content of your campaigns changes frequently and you have no need to store templates, you can add the Text / HTML contents directly into your campaign draft. To accomplish that, do a POST /campaigndraft/{draft_ID}/detailcontent call:
curl -s \
-X POST \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/campaigndraft/$draft_ID/detailcontent \
-H 'Content-Type: application/json' \
-d '{
"Headers":"object",
"Html-part":"<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
"MJMLContent":"",
"Text-part":"Dear passenger, welcome to Mailjet! May the delivery force be with you!"
}'{
"Count": 1,
"Data": [
{
"Headers": "object",
"Html-part": "<h3>Dear passenger, welcome to Mailjet!</h3><br />May the delivery force be with you!",
"MJMLContent": "",
"Text-part": "Dear passenger, welcome to Mailjet! May the delivery force be with you!"
}
],
"Total": 1
}