Get template ID for a campaign

902 views
Skip to first unread message

ad...@blindmotion.com

unread,
Jul 1, 2010, 1:42:46 AM7/1/10
to MailChimp API Discuss
Hello

im using the php mc api class and im having trouble working out how to
retrieve the template ID that an existing campaign is using.

As i need to update the capaigns html content and after reading the
only way to do this is
1. set the campaigns template to 0
2. get the html content
3. reset the campaigns template id to the orignal value
4. update the content

Hope this is correct i just cant see where i gather what template the
selected campaign is using.

adam

jesse

unread,
Jul 1, 2010, 10:52:51 AM7/1/10
to MailChimp API Discuss
The template_id is not currently returned by the campaigns() method,
but you shouldn't need it for this scenario. To update campaign
content, all you need to do is run campaignUpdate with the field as
"content" and the value as the proper content array (just like you
would have used with campaignCreate()).


jesse

On Jul 1, 1:42 am, "a...@blindmotion.com" <a...@blindmotion.com>
wrote:

adom

unread,
Jul 1, 2010, 7:59:19 PM7/1/10
to MailChimp API Discuss
Hi jesse i dont have any problem updating or getting the content. When
the html content is called it pulls the entire template + content
html, i cant expect users to edit this kind of html. i just need the
main content area. Like they enter when a campaign is first created.

At the moment im wrapping each content on creation in comment tags
then stripping the individual sections out of the return content html,
when a user wants to edit the html.

If i set the template id to null i can get just the content html that
was originally entered however now my campaign doesn't have a template
associated with it,

hopefully the template id will find its way into the next release as i
would really like to show what templates people have chosen for a
particular campaign.

regards
adam

jesse

unread,
Jul 2, 2010, 10:46:45 AM7/2/10
to MailChimp API Discuss
Ok, I see I misunderstood what you were talking about. We typically
refer to those as "section names" or "mc:edit" areas since
"template_id" is already a term used to describe the full template
that encases them and then is applied to a campaign.

Then, yes, the ability to call campaignContent() and get the section
separated is going to be included in the next release.


jesse
Reply all
Reply to author
Forward
0 new messages