It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Body of a comment in a jira issue via REST API

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

@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 

@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 Jan 16, 2020

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

Like # people like this

@Veera 

thanks for the help...... 

i'll filter out the data from json format

Like Veera likes this
Veera Atlassian Team Jan 16, 2020

You are welcome @dharm6619 

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you