Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can I sort the the search jira api by priority, status and date?

Josh Babcock
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!
August 16, 2023

The below "get" request is displaying all the Jira tickets for a specific project.   I provided the types of what the current getBacklogDashboard is returning.  I have tried a bunch of solutions around "&orderBy=priority=desc".   


`interface JiraIssue {
id: string;
key: string;
fields: {
summary: string;
created: string;
status: {
name: string;
id: string;
};
priority: {
name: string;
id: string;
};
project: {
name: string;
};
issuetype: {
name: string;
id: string;
}
};
editmeta: {
fields: {
priority: {
allowedValues: {
id: string;
name: string;
}[];
};
issuetype: {
allowedValues: {
id: string;
name: string;
}[];
};
};
};
}`


`async function getBacklogDashboard(
query: string,
page: number
): Promise<JiraDashboardResponse> {
const startAt = (page - 1) * 50;
const dashboardResult = await jiraFetcher({
jiraPath: `/search?jql=project=${query}&fields=summary,status,created,priority,project,issuetype&expand=editmeta&issuetypeIds&fieldsByKeys=true&startAt=${
startAt ? startAt : 0
}`,
});`


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

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events