2 Replies Latest reply on Nov 6, 2019 10:41 AM by jwd2bc

    Invalid HTML in content text field

    nrajesh Novice

      Hi All,

       

      create discussion via REST API (/api/core/v3/contents) throws error recently like below, before it was working fine.

       

      { "error":{ "message": "Invalid HTML in content text field","status": 400,"code": "contentBodyInvalid" } }

       

      When I analyze the root cause of this issue I found that character '&' is making the problem. I don't know why the API accepts Subject field having '&' but not content.

       

      Example:

      "subject":"[1234567] - [abc & xyz Inc.] - [[abc] abcdefghjk]"

       

      Working:

      Migration KX(~!@#$%^*)

       

      NotWorking:

      Migration KX(~!@#$%^&*)

       

      Request:

      {

           "type":"discussion",

           "question":true,

           "parent":"https:\/\/abc.com\/api\/core\/v3\/places\/543210",

           "subject":"[1234567] - [abc & xyz Inc.] - [[abc] abcdefghjk]",

           "content":{

                "type":"text\/html",

                "text":"<pre\">

                          ID #: <a href=\"https:\/\/abc.com\/case?id=1234567\">1234567<\/a><br>

                          Product1: abc<br>

                          Product2: xys<br>

                          <strong>Question 1?:<\/strong> <br>Migration KX(~!@#$%^&*)<br>

                          <strong>Question 2?:<\/strong> <br>Migration KX<br>

                          <\/pre>"

           }

      }

       

      Can you guys please give some suggestion to fix this.

       

      Regards

      Rajesh