1

Im trying to create an email via REST API, based on an existing template. The only real documentation I can find is https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-apis.meta/mc-apis/content.htm But it dosnt show how I use an existing template, only creating new HTML PASTE email.

Have anyone tried to do this, or have some examples of this?

EDIT: I have managed to get the correct template, but is dosnt put content in my slot called "contentarea2".

{
  "assetType": {
    "id": 207
  },
  "name": "Test_9",
  "views": {
    "subjectline": {
      "content": "Hello"
    },
    "preheader": {
         "content": "preheader text here"
    },
    "html": {
        "template": {
        "id": 86912,
        "slots": {
        "contentarea2": {
            "content": "<div data-type=\"block\" data-key=\"block1\"></div>",
            "design": "click here to start editing this block",
            "blocks":{
                "block1":{
                    "content":"123",
                        "design":"click here to start editing this block",
                        "assetType":{  
                           "name":"freeformblock",
                           "id":195
                        }
                }
            }
        }
      }
    }
    },
    "data": {
      "email": {
        "options": {
          "characterEncoding": "utf-8"
        }
      }
    }
  }
}
  • I tried this with the SOAP API a few years ago and it wasn't possible. I doubt if the REST can do it. The only way back then was to create an HTML Paste every time. – garek007 Apr 26 '18 at 16:08
  • They write: 'the templated is pulled from an existing template asset and therefore has an id'. So I understand it as it is possible. – Rasmus Bidstrup Apr 26 '18 at 16:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.