Re: Updating emails via API without a template?

Phillip_Wild
Level 10 - Community Advisor

Updating emails via API without a template?

I just tried to update an email subject line via the API and got the following error:

{

    "requestId": "e064#161345f3192",

    "success": false,

    "errors": [

        {

            "code": "709",

            "message": "API only allows operations on emails with a template"

        }

    ]

}

I mean - it's pretty clear in the message itself - but I just wanted to double check that it wasn't possible to update anything in an email when it doesn't have a template. This would be quite annoying - we don't really use email templates in Marketo and instead create them in Dreamweaver, then copy the code in. So virtually none of our emails are attached to a template.

I'm hoping there's a solution here since there are 250ish emails I need to update...

11 REPLIES 11
Grégoire_Miche2
Level 10

Re: Updating emails via API without a template?

Hi Philip,

The API doc (http://developers.marketo.com/rest-api/assets/emails/ ) is quite clear about the fact that emails can be created and update only from a source template, unfortunately.

But there is another endpoint that enables you to replace the full HTML : http://developers.marketo.com/rest-api/endpoint-reference/asset-endpoint-reference/#!/Emails/createE...

have you tried it ?

-Greg

Phillip_Wild
Level 10 - Community Advisor

Re: Updating emails via API without a template?

Thanks Grégoire!

No I wasn't aware of that endpoint....seems quite handy! Forgive my naivety...but is it possible to update subject lines using that endpoint? Updating the HTML is useful, but in this particular circumstance I need to replace subject lines.

As a secondary question, that endpoint requires a "multipart file". What is that and how would I implement it?

Thanks!

Grégoire_Miche2
Level 10

Re: Updating emails via API without a template?

Hi Phillip,

Use this other endpoint to change the email header : http://developers.marketo.com/rest-api/endpoint-reference/asset-endpoint-reference/#!/Emails/updateE...

The multipart email is the format that enables you to include both the HTML and text version. The standard is here :RFC1341(MIME) : 7 The Multipart content type and some much easier information from Litmus: Improve Your Spam Score With Multi-Part Emails —Litmus Software, Inc.

-Greg

Phillip_Wild
Level 10 - Community Advisor

Re: Updating emails via API without a template?

Hi Grégoire

Unfortunately that's the original endpoint I was using, which gives me the error above....so it seems there is no way to update the subject line unless the emails are in a template then? That other endpoint is useful, but without the ability to modify subject lines via API I can't solve my original problem

SanfordWhiteman
Level 10 - Community Moderator

Re: Updating emails via API without a template?

Program-level {{my.token}}?

Phillip_Wild
Level 10 - Community Advisor

Re: Updating emails via API without a template?

Would be perfect....but unfortunately all of these emails were set up with hardcoded subject lines So unless I go through and replace them all with tokens (which is future-proofed, but still time-consuming) I'm out of luck...

SanfordWhiteman
Level 10 - Community Moderator

Re: Updating emails via API without a template?

Yeah. That. Ugh.

Grégoire_Miche2
Level 10

Re: Updating emails via API without a template?

Yes, I am afraid so

Phillip_Wild
Level 10 - Community Advisor

Re: Updating emails via API without a template?

Ah well. Time to bite the bullet I think. Folder level token, then update every subject line manually to be that token. At least it's one update if it ever needs changing again.

Ah, to have set this up when I was older and a bit wiser....

Thanks for your help all.