Uploaded image for project: 'Jira Platform Cloud'
  1. Jira Platform Cloud
  2. JRACLOUD-71136

The /rest/api/3/search endpoint does not return comments and worklog comments as HTML even if we pass parameter expand=renderedFields. Everything works fine using the v2 endpoint

XMLWordPrintable

      Problem Definition

      /rest/api/3/search does not return comment.body and worklog.body fields rendered in HTML even if we pass parameter expand=renderedFields.. This works well in Rest API v2

      Steps to Reproduce

      1. Call the search endpoint version 2 in order to return some issues with comments and worklog like, e.g.: https://INSTANCE-URL/rest/api/2/search?jql=project%20%3D%20TRP%20ORDER%20BY%20key%20ASC&fields=comment,description,summary,worklog&expand=renderedFields
      2. See that the above endpoint returns the worklogs and comment details in HTML:
        [...]
              "key": "TRP-1",
              "renderedFields": {
                "summary": null,
                "description": "<p>DESCRIPTION</p>\n\n",
                "comment": {
                  "comments": [
                    {
                      "self": "https://xxxxx.atlassian.net/rest/api/2/issue/10504/comment/10218",
                      "id": "10218",
                      "author": {
                        "self": [...]
                        },
                        "displayName": "[...]
                        [...]
                      },
                      "body": "<p>comment</p>",
        [...]
                "worklog": {
                  "startAt":[...]
                   [...]
                  "worklogs": [
                    {
                      "self": [...]
                      },
                      "updateAuthor": {
                        "name": "ID10850",
                        "active": false
                      },
                      "comment": "<p>Logged one day of work…</p>\n\n<p>Still 2 days to go&#33;</p>",
        [...]
        
      1. Run the same search query using the V3 endpoint: https://INSTANCE-URL/rest/api/3/search?jql=project%20%3D%20TRP%20ORDER%20BY%20key%20ASC&fields=comment,description,summary,worklog&expand=renderedFields

      Expected results

      The same body as v2 is returned

      Actual result

      The worklog comments body is missing and the issue comments body is not rendered:

      [...]
            "key": "TRP-1",
            "renderedFields": {
              "summary": null,
              "description": "<p>DESCRIPTION</p>\n\n",
              "comment": {
                "comments": [
                  {
                    "self": "https://xxxxxxx.atlassian.net/rest/api/3/issue/10504/comment/10218",
                    "id": "10218",
                    "author": {
                     [...]
                      },
                      "displayName": "[...]
                      [...]
                    },
                    "body": {
                      "version": 1,
                      "type": "doc",
                      "content": [
                        {
                          "type": "paragraph",
                          "content": [
                            {
                              "type": "text",
                              "text": "comment"
                            }
                          ]
                        }
                      ]
                    },
      [...]
              "worklog": {
               "startAt":[...]
                 [...]
                "worklogs": [
                  {
                    "self": [...]
                    },
                    "updateAuthor": {
                      "name": "ID10850",
                      "active": false
                    },
                    "created": "Today 12:56 PM",
                    "updated": "Today 12:56 PM",
                    "started": "Today 4:56 AM",
                    "timeSpent": "1 day",
                    "id": "10003",
                    "issueId": "10504"
                  }
                ]
              }
            },
      

       

      Workaround

      Two possible workarounds:

      1. Use the v2 endpoint. 
      2. Another way to get the comment body returned as HTML is to call the GET /rest/api/3/[ISSUE KEY or ID]/comments endpoint and append ?expand=renderedBody to it. This way you get something like:
         
        "renderedBody": "<p>SOME COMMENT<br/>\nTEST BODY<br/>\nsadff<br/>\ndffffffffffffff</p>\n\n<p>istamana</p>\n\n<p>I write a comment</p>",
        

      Unluckily this does not work for worklogs comments.

              akonkolowicz Adrian Konkolowicz
              ssuvarna@atlassian.com Shwetha Suvarna
              Votes:
              29 Vote for this issue
              Watchers:
              36 Start watching this issue

                Created:
                Updated: