Hi community,
I'm working on a Jira Data Center instance (version 9.12.12) and facing an issue when trying to retrieve the issue type of an issue programmatically.
When using the Atlassian Java API:
issue.getIssueType().getName()
It returns an unexpected or incorrect issue type.
However, when I fetch the same issue via the Jira REST API:
GET /rest/api/2/issue/{issueIdOrKey}
It returns the correct issue type.
I have created a custom issue type called "Feature". That feature is associated with this issue, KSD-8.
While fetching this issue through JQL via Atlasian Java classes in the data center, the response in which issue type was expected issue type, is "Feature", but the Java API returns "Epic" instead.
Here is the correct REST API response:
"issuetype": {
"self": "http://localhost:2990/jira/rest/api/2/issuetype/10014",
"id": "10014",
"description": "conversion of epic",
"iconUrl": "http://localhost:2990/jira/secure/viewavatar?size=xsmall&avatarId=10307&avatarType=issuetype",
"name": "Feature",
"subtask": false,
"avatarId": 10307
}
Verified issue type schemes and associations.
Reindexed the instance.
Restarted Jira and cleared plugin caches.
Why does the Java API return the wrong issue type (e.g., "Epic") when the REST API and UI clearly show the correct type ("Feature")?
Any help or suggestions would be greatly appreciated.
Thanks in advance!
Sainath Bembre
@sainath The issue type names can be translated!
I think it is worth a try if this getter returns what you expect:
issue.getIssueType().getNameTranslation()
Also, what you could also check if the getId() getter on the issue type returns the same ID that is returned by the REST API.
If it does, at least you can be sure that you are working with the issue type and only the name differs. If even the IDs are different, it means you are looking at two different issue types!
Hi @sainath
could you please share the complete Java code you are using? It might be that this is something with the retrieval of the issue object. Usually the Java API and REST API should be returning the same results.
Furthermore: Are you using translations on your instance? I have been running in strange issues using translations, so that also might come into play here.
Regards,
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.