Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-77862

Error in Confluence Create Page REST API Due to Special Characters in the Request body

XMLWordPrintable

      Issue Summary

      The Create Page REST API is encountering an issue when special characters, specifically '&', are included in the Jira field passed in the Request body. The error produced is "Error parsing xhtml", suggesting an issue with processing these special characters.

      Steps to Reproduce

      1. Create a Jira issue
      2. Add '&' in any of the custom fields
      3. Use the Create Page or Create Content API to create a Page in Confluence 
      4. Use the API and pass Jira field in the Request body
      5. Run the rule

       

      // example custom data for API - https://<sitename>.atlassian.net/wiki/api/v2/pages
      //custom data:
      
      {
        "spaceId": "ID",
        "status": "current",
        "title": "Page Title - {{issue.key}}",
        "parentId": "PageID",
        "body": {
              "value":  "<ac:layout><p>{{issue.customfield_xxxxx}}</p></ac:layout>",
              "representation": "storage"
        }
      } 

       

      Expected Results

      The automation is run successfully and the new page is created in Confluence.

      Actual Results

      The API call fails

      "errors": [
          {
            "status": 400,
            "code": "INVALID_REQUEST_PARAMETER",
            "title": "Error parsing xhtml: Unexpected character ' ' (code 32) (missing name?)\n at [row,col {unknown-source}]: [x,xxx]",
            "detail": null
          } 

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

              jramos@atlassian.com Josh Ramos
              c2d78d0f7204 Amin A.
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: