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
}`,
});`
Welcome to the Atlassian community.
To effectively sort your Jira search results with the API, just include the ORDER BY clause directly inside the JQL string instead of adding a separate URL parameter like &orderBy=. Your previous attempts haven't worked because the Jira REST API /search endpoint doesn't recognize an independent orderBy parameter. Instead, it needs all sorting instructions to be included within the JQL query itself.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.