2

post campaigns

{
    "type" :"regular",
    "recipients": {
        "list_id": "0270xxxcf7"
        }
    ,
    "settings": {
        "subject_line": "Thank you for your reservation",
        "from_name": "Customer Service",
        "reply_to": "reception@xxxx.com",
        "template_id": 37125
    }
}

every time the response is with ["template_id"]=>int(0)

I tried with php script and directly from "Developer Playground"... I got the same response. Seems it's not possible to set the template id when you create a new campaign.

If I setup template_id: '37125' I receive this error:

template_id must to be integer

I tried with intval(37125)....nothing, I got the same ["template_id"]=>int(0) response.

Can somebody help me with this issue?

ekad
  • 14,436
  • 26
  • 44
  • 46
Prova Web
  • 21
  • 2
  • According with MailChimp help support: In 3.0, the campaign settings and the content of the campaign are split into two separate calls. This would explain why the template ID isn't being set when POSTing to the /campaigns/ endpoint. Once you've created that campaign, the template can be added by making a PUT request to /campaigns/{campaign_id}/content. Using your example, the JSON for that call would look like this: { "template": { "id": 37125 } } – Prova Web Jan 06 '16 at 08:15

1 Answers1

0

You have to use the "Set campaign content" option

/campaigns/{campaign_id}/content

Clintu
  • 25
  • 4
  • Please review [how to write a good answer](http://stackoverflow.com/help/how-to-answer). Please add some references and broaden your explanation. – Quintin Balsdon Dec 20 '16 at 14:07