SOLVED

Re: Restoring an email content

Go to solution
tariq_grazitti
Level 1

Restoring an email content

Hi,

I am trying to restoring an content of email so for that i am using this 

/rest/asset/v1/email/{id}/content/{htmlId}.json

 

this api where i pass an three parmas in form-data i.e value,type,overWrite but its still does't work can anyone  help me sort out this problem so that i wll be able to update an email content 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
SanfordWhiteman
Level 10 - Community Moderator
6 REPLIES 6
SanfordWhiteman
Level 10 - Community Moderator

Re: Restoring an email content

You need to provide the actual payload you’re POSTing, not just the URL.

 

Also, “doesn’t work” needs elaboration.

tariq_grazitti
Level 1

Re: Restoring an email content

Hi,

Below is request i am using

https://196-UQU-425.mktorest.com/rest/asset/v1/email/4251/content/body/access_token=859e615e-d87b-4a...

Body Params

{"form":{
    "value":"<div>Dear {{lead.First Name:default=Friend}},</div>\n<div><br /></div>\n<div>We are pleased to inform you that you have been accepted at Hogwarts School of Witchcraft and Wizardry. Please find enclosed a list of all necessary books and equipment. Term begins on September 1. We await your owl by no later than July 31.</div>\n<div><br /></div>\n<div>Yours sincerely,</div>\n<div>Minerva McGonagall</div>\n<div>Deputy Headmistress <a href=\"https://countingdownto.com/email-countdown/zPFg4AUEiPd0Vw\" target=\"_blank\" style=\"display: block; text-align: center;\"><img style=\"max-width: 346px; max-height: 203px; width: 100%;\" src=\"https://w3.countingdownto.com/g/zPFg4AUEiPd0Vw\" /></a></div>",
    "type":"Module",
    "overWrite":true
}}


Please let me know what exactly i am doing wrong  in this request.

Thankyou




SanfordWhiteman
Level 10 - Community Moderator

Re: Restoring an email content

Please use the Syntax Highlighter when posting snippets ("Insert/Edit Code Sample"). I edited your post this time.

 

Your URL is not valid. The access_token is a query param, not part of the path.

 

Your body isn’t a URL-encoded payload, it’s JSON. If you’re actually sending that, it’ll never work.

 

Module is not in the type enum.

 

I would urge you to go over the documentation and examples once again, as there are too many errors here.

tariq_grazitti
Level 1

Re: Restoring an email content

Hi, can you please share the documentation link that will be very helpfull

Thanks

SanfordWhiteman
Level 10 - Community Moderator
tariq_grazitti
Level 1

Re: Restoring an email content

Hi Sanford

Thanks for sharing an documentation link now its working fine but i got an another error defined below while i am passing an type="HTML" it throw the error but It work fine in case of type=Text

{"code":"709","message":"Content Type specified is not valid for the component"}

below is the request can you please look into this and let us know what exact issue are there.

curl --location --request POST 'https://196-UQU-425.mktorest.com/rest/asset/v1/email/4251/content/body.json/?access_token=7c23c3d5-9...' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'value=<div>Dear {{lead.First Name:default=Friend}},</div>\n<div><br /></div>\n<div>We are pleased to inform you that you have been accepted at Hogwarts School of Witchcraft and Wizardry. Please find enclosed a list of all necessary books and equipment. Term begins on September 1. We await your owl by no later than July 31.</div>\n<div><br /></div>\n<div>Yours sincerely,</div>\n<div>Minerva McGonagall</div>\n<div>Deputy Headmistress <a href=\"https://countingdownto.com/email-countdown/zPFg4AUEiPd0Vw\" target=\"_blank\" style=\"display: block; text-align: center;\"><img style=\"max-width: 346px; max-height: 203px; width: 100%;\" src=\"https://w3.countingdownto.com/g/zPFg4AUEiPd0Vw\" /></a></div>' --data-urlencode 'type=Html'


Thanks