5 Replies Latest reply on May 21, 2018 9:02 PM by Sanford Whiteman

    Update Email Content API

    API Dev

      So I see in the http://developers.marketo.com/rest-api/assets/emails/#update_editable_section part where it is mentioned that the data is passed as x-www-form-urlencoded and not JSON. I tried to pass HTTP headers as:

       

      curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/x-www-form-urlencoded'));
      


      but I'm always getting the following error:

       

      "success":false,"errors":[{"code":"611","message":"Content Type specified is not valid for the component"}
      

       

      Anyone else got this same error while using this API endpoint? I've tried to add 'accept' in the header as well with value 'application/json', but I still get the same error. Any suggestions would help. Thanks

        • Re: Update Email Content API
          Sanford Whiteman

          No problem here.

           

          I imagine you're putting something wrong on the wire.

           

          Note providing PHP/php_curl code isn't narrowing down the problem enough. We don't all use your programming language, but many of us know what needs to be sent to the API at the HTTP level. So you should use Postman or cURL (command line) or another language-agnostic tool to build up to using your language.

            • Re: Update Email Content API
              API Dev

              Now, here's the weird thing. The email I'm trying to update via API is in a program that is cloned from another program (also via API), and I get this error. If I take any other email in a program manually cloned from the other program or any email with editable sections, I get success as 'true', and no error. It is just weird why I get error with API cloned emails and not with any other email (they are also of same template).

                • Re: Update Email Content API
                  Sanford Whiteman

                  There's occasional weirdness with API-cloned assets that require them to be (interactively) unapproved, then reapproved.  Try that and see.  I know some of these bugs have been cleared up but some remain. In any case I don't think this is really a Content-Type issue.

                    • Re: Update Email Content API
                      API Dev

                      Hi Sanford,

                       

                      Thanks for your reply. So, I've found the solution and it's working fine, except when special HTML characters and latin characters are involved. The same function that does all the html encoding and string replacement, easily stores the content in the tokens (rich text), but it won't update full content in emails directly via update content API call. The content breaks whenever a special character appears.

                       

                      For example, in the token the content: Cédric Dananché is stored completely. But via the UpdateEmail Content API, the content breaks at C. The special character and the remaining content after it won't update in the editable section of the email.

                       

                      Do I need to try something else here or is this a marketo API issue?