API to get the translations of priority and other Issue Attributes

Georgi Gachev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2022

Hi everyone,

I'm on Cloud and trying to find a way to get the translation mapping for Issue Priority (and the other issue attributes) through the REST APIs but I can't find anything that can work. I'm configuring the translations through https://<my_cloud_instance>/secure/admin/ViewTranslations!default.jspa?issueConstantType=priority

Capture1.PNGWhen I use translated values like that I receive them when using the "get issue" REST (/rest/api/2/issue/<issue_key>) but I only get the translated value and there is no way for me to get the original value based on this.

{"self":"https://<my_cloud_instance>/rest/api/2/priority/2","iconUrl":"https://<my_cloud_instance>/images/icons/priorities/high.svg","name":"Translated High","id":"2"}

 

I need it to create a JQL query using the original name because priority = "Translated High" doesn't work, it requires to be priority = "High"

Capture2.PNG

Any ideas will be appreciated.

Thanks,
Georgi

2 answers

1 accepted

0 votes
Answer accepted
Alexey Belostotskiy August 30, 2022

Hi,

Did you try the "name" property from /rest/api/latest/field?

Moreover, it has "clauseNames" which is basically the field name options that you can use in JQL query

Georgi Gachev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 30, 2022

Hi Alexey,

Thanks for your reply but I don't need the actual name for the property field, I need the translation mapping for the values of the field. In my example I need to know that if I get the priority "Translated High" it corresponds to the original value "High".

If I use the /rest/api/latest/field API all I get is how to use the priority field which I'm already doing and no information about the values or am I missing something?

{"id":"priority","key":"priority","name":"Priority","custom":false,"orderable":true,"navigable":true,"searchable":true,"clauseNames":["priority"],"schema":{"type":"priority","system":"priority"}}

Thanks,
Georgi

Alexey Belostotskiy September 8, 2022

Oh, sorry.

Is there a reason why you can't use priority ID in the JQL search query? It's the most robust option

Like Georgi Gachev likes this
Georgi Gachev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 6, 2022

Hi Alexey,

Thanks for the suggestion. I'm going to use the ID for the priority field but I am not sure it will work for all of the other fields that allow translations (such as Request Type). At any rate, I will investigate and see how I can implement most of the use cases until (if ever) Atlassian releases a way to get the translations through API.

Thanks again :)

Regards,
Georgi

0 votes
Julien March 12, 2024

Hi everyone

One way is described here https://jira.atlassian.com/browse/JRACLOUD-71793.


I was able to verify that the use of headers made it possible to obtain the values in the desired language, using both headers :
'Accept-Language': 'pl',
'X-Force-Accept-Language': 'true'

More information here : https://developer.atlassian.com/cloud/jira/platform/rest/v3/intro/#special-request-headers

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events