简体   繁体   English

如何通过API在MailChimp模板中设置可编辑的图像

[英]How to set editable image in MailChimp template via API

I made a template with an editable image ("Editable Content Area"), like so: 我制作了一个带有可编辑图像的模板(“可编辑内容区”),如下所示:

<img src="http://somewhere.com/foo.jpg" mc:edit="header_image">

When making a new campaign I can replace the image while using the MailChimp editor. 制作新广告系列时,我可以在使用MailChimp编辑器时替换图像。 But I don't seem to be able to replace the image using the API . 但我似乎无法使用API​​替换图像

If I include the URL to the image as the section content, it seems to be ignored and the campaign is created without the new image url being set. 如果我将图片的网址作为部分内容包含在内,则似乎会被忽略,并且会在未设置新图片网址的情况下创建广告系列。

    content: {
      sections: {
        header_image: "http://somewhere/else/bar.jpg",
        header: "Our latest newsletter",
        body: "<p>My fabulous content</p>",
        ... other named mc:edit section content ...
      }
    }

All other editable sections (text) are being properly replaced. 正确替换所有其他可编辑部分(文本)。

Question: How can I set the url of an mc:edit tagged image via the campaigns/create API? 问题:如何通过campaign / create API设置mc:edit标记图像的网址?

Unfortunately editable content areas are not supported in the MailChimp API. 不幸的是,MailChimp API不支持可编辑的内容区域。 The editable area was made for use within their own editors. 可编辑区域是为了在自己的编辑器中使用。

A workaround is to just have an editable content area and to put a full image tag into it via the API. 解决方法是只有一个可编辑的内容区域,并通过API将完整的图像标记放入其中。

For example; 例如;

content: {
  sections: {
    header_image: "<img src='http://somewhere.com/foo.jpg'>",
    header: "Our latest newsletter",
    body: "<p>My fabulous content</p>",
    ... other named mc:edit section content ...
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM