Body of a comment in a jira issue via REST API

dharm6619 January 15, 2020

I want to fetch only body of a comment on a jira issue but currently I'm getting whole content as - 

{
"self": "url over here",
"id": "185626",
"author": {
"self": "committer username ",
"name": "name",
"key": "key",
"emailAddress": "email-id",
"avatarUrls": {
##### URLS OVER HERE #####},
"displayName": "LN, FN",
"active": true,
"timeZone": "CET"
},
"body": "Here if the actual message",
"updateAuthor": {
"self": "committer username ",
"name": "name",
"key": "key",
"emailAddress": "email-id",
"avatarUrls": {
##### URLS OVER HERE #####},
"displayName": "LN, FN",
"active": true,
"timeZone": "CET"},
"created": "2019-09-19T10:15:46.697+0200",
"updated": "2019-09-19T10:15:46.697+0200"
}

 

 

But I want to access only body from this output 
How can I do it?

1 answer

2 votes
Veera
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2020

@dharm6619 

I don't think you can get comment body alone directly from the REST end point.

The output you shared is in JSON format. You can parse the JSON object and just extract body element value using JSON path: $.body in your script 

dharm6619 January 16, 2020

@Veera 

Isn't there any method at the time of rest api call which can filter this?. 
For example - for fetching comments - we can give fields as fields=comment... 
similarly a is it possible to provide a field inside the comment field itself???

Like Veera likes this
Veera
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2020

@dharm6619 there is no option to filter only body while making the RESP call.

Like # people like this
dharm6619 January 16, 2020

@Veera 

thanks for the help...... 

i'll filter out the data from json format

Like Veera likes this
Veera
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 16, 2020

You are welcome @dharm6619 

Like # people like this

Suggest an answer

Log in or Sign up to answer