1

I'm trying to update an HTML Email Template that I have created on SFMC, I make a HttpRequest using the following call on Apex:

https://www.exacttargetapis.com/asset/v1/{Id}

The body of the Json is the following:

request.setBody('{"views":{"html":{"content":"'+htmlBody+'"}},"assetType":{"name":"htmlemail","id":208}}');

in where the variable htmlBody contains a valid HTML page. If I make the call using an external tool (like Postman or Advanced Rest Client of Google) it works fine and the HTML Email template was successfully updated, but if I make the call on Apex (using POST, PUT or PATCH) then the following error appears:

System.HttpResponse[Status=Bad Request, StatusCode=400]

I also tried to escape the quotes that the HTML contains and also use the simple quote but the same error keep appearing.

I really appreciate any suggestions!

Regards!

Alvaro

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.