The value you're seeing is a lexorank token.
If you need a numerical ranking (e.g. rank 15 of 100), you may want to fetch the total list of issues through the JIRA search endpoint using JQL (their limited query language), and enumerate the results or search for the issue you need by key while incrementing or updating some rank number. If your query returns several results, performance matters, and you only require a single issue, you may want to use a more intelligent search like binary search.
Here's a rough example using the node client:
import jiraAPI from 'jira-client'
const jira = new jiraAPI({
protocol: 'https',
host: process.env['JIRA_HOST'],
username: process.env['JIRA_USERNAME'],
password: process.env['JIRA_PASSWORD'],
apiVersion: '2',
strictSSL: true,
timeout: 30000, // 30s
})
const JQL = 'project = "your-project" AND status IN ("To Do", "In Progress", "Blocked") order by status desc, Rank asc'
const FIELDS = ['key', 'priority', 'status', 'summary', 'labels', 'assignee']
const formatIssue = ({ issue: { key, fields = {} }, rank = 0, total = 0 }) => ({
key,
rank,
total,
priority: fields.priority.name,
status: fields.status.name,
summary: fields.summary,
assignee: fields.assignee ? fields.assignee.displayName : null,
labels: fields.labels
})
async function* issueGenerator ({ offset = 0, limit = 100 }) {
for (let max = 1; offset < max; offset += limit) {
const { total = 0, maxResults = 0, startAt = 0, issues = [] } = await jira.searchJira(JQL, {
startAt: offset,
maxResults: limit,
fields: FIELDS
})
max = total
limit = maxResults
offset = startAt
for (let i = 0, len = issues.length; i < len; i++) {
yield formatIssue({ issue: issues[i], rank: offset + i + 1, total })
}
}
}
async function fetchIssuesWithLabel (label) {
const issueIterator = issueGenerator({ offset: 0, limit: 100 })
const teamIssues = []
for await (const issue of issueIterator) {
if (issue.labels.includes(label)) {
teamIssues.push(issue)
}
}
return teamIssues
}
fetchIssuesWithLabel('bug').then(result => console.log(result))