Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

RestAPi Jira getepics from project but comments field is empty

Leon Stall
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
December 10, 2023

Hi,

So I´m currently trying to fetch all of my epics from the project but am encountering the problem that the comments field is an empty array even tho it isn´t empty and that there are comments on the normal requested epic with the epicId.

I am using the following code:

async getEpicsByProject(projectIdOrKey: string): Promise<Issue[]> {
return new Promise((resolve, reject) => {
this.getRestApiClient(3)
.get(`search?jql=issuetype = Epic AND project = ${projectIdOrKey}`)
.then(async (response) => {
const epics: Promise<Issue[]> = Promise.all(
response.data.issues.map(async (element: JiraIssue) => ({
issueKey: element.key,
assignee: {
displayName: element.fields.assignee?.displayName,
avatarUrls: element.fields.assignee?.avatarUrls,
},
comment: element.fields.comment ?? {
comments: [],
}
subtasks: element.fields.subtasks,
created: element.fields.created,
}
}

2 answers

1 accepted

1 vote
Answer accepted
Stefan Salzl
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2023

Hi @Leon Stall 

welcome to the community.

Could you tey to add the „fields“ query parameter to your call so that the response delivers all fields

this should be fields=*all according to the following docu:

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-search/#api-rest-api-3-search-get-request-Query%20parameters

Best
Stefan

0 votes
Hana Kučerová
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2023

Hi @Leon Stall ,

welcome to the Atlassian Community!

To be able to get issue comments, you need to use different REST API endpoint, see here

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events