10

Is there a way to get the actual html file in Mailchimp API 3.0? I tried this method, /3.0/templates/{template-Id}?apikey={myAPIkey} but it's not returning the actual file, it's giving me the thumbnail of the template.

ekad
  • 14,436
  • 26
  • 44
  • 46
TheDevGirl
  • 101
  • 1
  • 3

4 Answers4

11

There is currently no single API call to get the HTML source for a template as there is in API 2.0. Below is the reply I got from MailChimp support on December 9th, 2016:

Thanks for reaching out to us with your question. At this time, API 3.0 does not contain a direct corollary that allows for the "source" of a Template to be retrieved. However, we are continuing to update the 3.0 version of the API in hopes of achieving parity with 2.0, so I will be passing this feedback along internally to our team. In the meantime, the only workaround available for retrieving the HTML in the same format would be to create a Campaign using the Template in question and then retrieve the source using the /campaigns/{campaign_id}/content endpoint.

Dirk Wessels
  • 339
  • 2
  • 8
  • 5
    2.5 years since this answer and it is still not available :( – Raj Nov 15 '18 at 00:01
  • 3
    Make that 3 years. I talked to support in hopes it get passed to the team. – Andries May 27 '19 at 07:57
  • 1
    it's pretty obvious to me that this was removed on purpose: to send emails with mailChimp templates, you need to use Mandrill, which requires to have a paid MailChimp account and $20 per block of emails per month. Too many have abused the free mailchimp, building templates there and pulling the html out to send emails with the free mailgun or sendgrid accounts. – MrE Jun 27 '19 at 22:23
4

I solved this by update campaign content with template id and sections.

  1. Get template id link
  2. Get template section link
  3. Update id and sections in template object in campaign content link
Hrvoje
  • 696
  • 7
  • 22
0
require_once('..includes/Mailchimp/Mailchimp.php');
$apiKey = "apikey-usx";
$mailchimpObj = new Mailchimp($apiKey);

printr($mailchimpObj->template['your template id here']);
echo "<pre>";

See the working API: https://devsnook.com/get-mailchimp-template-html-content/

Dar Adal
  • 1
  • 1
-3

You're looking for the default-content sub-object. Check out the documentation page for that endpoint here.

TooMuchPete
  • 4,583
  • 2
  • 17
  • 21