Get all fields including comments in search rest api results

Hi,

Is there any way to retrieve all fields including comments in results using post search rest api?

POST /rest/api/2/search

Hi @sbonagiri,

I’m not sure if this is possible. I tried testing without providing the fields in the payload and I got most of the fields except for the comment. If you want to get the comment, your request should look something like this like this:

{
    "jql": "",
    "startAt": 0,
    "maxResults": 20,
    "fields": [
        "comment"
    ]
}

Cheers,
Anne

1 Like

Hi @sbonagiri,

On the Jira search POST method, to pull down all fields in the search results, including comments, you can use:

{ "jql": "", "startAt": 0, "maxResults": 20, "fields": [ "*all" ] }


but that’s a pretty heavy-handed call (meaning the payload can be huge). I would follow @acalantog’s example, with just comment and then add more field values to the array – just cherry picking the ones you need. For instance, if you just need comments and summary, then you’d use something like:

{ "jql": "", "startAt": 0, "maxResults": 20, "fields": [ "comment", "summary" ] }

The default values field value is *navigable. More info on how to use fields, see: https://developer.atlassian.com/cloud/jira/platform/rest/#api-api-2-search-get

Thanks,
Neil

3 Likes

Thanks!! That worked for me. I will not use unless there is on other option

What value should I provide for “jql”? I am giving the below json string. submitted using POST method.
data = ‘{ “jql”: [“updated”>=“2020/07/02 10:09” and project=YYY], “startAt”: 0, “maxResults”: 20, “fields”: [“key”, “comment”, “summary” ] }’

Getting Error Message:
{‘errorMessages’: [‘Can not instantiate value of type [simple type, class com.atlassian.jira.rest.v2.issue.IssueUpdateBean] from JSON String; no single-String constructor/factory method’]}