Forums

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

JIRA Rest API -Get Issue - Display fields as in JIRA UI

CRM Support February 20, 2018

Hi, 

I am using REST API calls from Salesforce to pull information from JIRA. Is there a way I can get the same set of fields that the user sees while accessing JIRA issue as part of the REST response. Currently, the response sends me all fields related to the issue and showing that is not a good user experience.

JIRA end point => http://<<servername>>/rest/api/2/issue/<<issue#>>

Thanks.

2 answers

0 votes
Danyal Iqbal
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.
February 22, 2018

Is there a way I can get the same set of fields that the user sees while accessing JIRA issue as part of the REST response.

 

this is the default behaviour. All fields present on the view screen are sent. You need to parse the JSON and select only the fields you need.

You can also specify a comma separated list of fields, if oyu only wish to get a few fields.

Thomas Deiler
Community Champion
February 22, 2018

Dear @Danyal Iqbal,

this is the default behaviour. All fields present on the view screen are sent. You need to parse the JSON and select only the fields you need.

you can read in the upper reply of CRM Support, that it isn't the case, otherwise the whole question would be obsolete.

Please post only information that will lead to solve the questioners issue.

So long

Thomas

Danyal Iqbal
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.
February 22, 2018

Hmmm. I was under the impression that REST obeys the same rules that the UI obeys, which also explains why a field won't appear if you remove it from the screen - it's not there in the UI, so it's not there in REST.

Looks like I am expecting too much from Jira. I will recheck the behaviour and report:)

0 votes
Thomas Deiler
Community Champion
February 21, 2018

Dear @CRM Support <-- nice name,

have you checked parameter "navigable":

By default, all (*all) fields are returned in this get-issue resource. Note: the default is different when doing a jql search -- the default there is just navigable fields (*navigable).

So long

Thomas

CRM Support February 21, 2018

Hi Thomas, 

Thanks for the response. Tried the following -

http://<<servername>>/rest/api/2/issue/A1234?fields=navigable . 

This brings me back the following response -

{
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"id": "12345",
"self": "http://<<servername>>/rest/api/2/issue/12345",
"key": "A1234"
}.

Also, tried the expand option with "renderedFields" and it doesn't change the response either.

Thanks.

Thomas Deiler
Community Champion
February 21, 2018

Dear @CRM Support,

additionally to the 'fields' param you have to use the 'expand' param. API tries always to send as less as possible.

Which fields would you expect in the JSON response?

So long

Thomas

CRM Support February 21, 2018

Hi Thomas, 

The get issue REST end point brings me back all the fields that is related to the issue. Instead I would like to get back a response that has the exact fields that the user sees when viewing the issue in JIRA.

I tried the following with no luck-

http://<<servername>>/rest/api/2/issue/A1234?fields=navigable&expand=renderedFields . 

This brings me back the same response as before-

{
"expand": "renderedFields,names,schema,operations,editmeta,changelog,versionedRepresentations",
"id": "12345",
"self": "http://<<servername>>/rest/api/2/issue/12345",
"key": "A1234"
}.

Thanks.

Thomas Deiler
Community Champion
February 22, 2018

Dear @CRM Support,

if this is the response, there is not really a lot of information inside, or?

The response should look like this example response:

https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue-getIssue

Have you tried to 

expand=renderedFields,names,schema,operation

So long

Thomas

CRM Support February 22, 2018

Hi Thomas,

The problem is that when I use all the options with just the expand, it dumps info related to all fields on the issue and when I use the expand option along with fields=navigable it displays the same output as in my previous replies.

My need is to show the same fields that gets displayed in JIRA view issue page on the Salesforce UI.

Also, what I am not able to get from the documentation is the definition of *navigable - where I expect the response to have the fields that gets shown in JIRA view issue page.

  • *navigable - include just navigable fields

Thanks.

Thomas Deiler
Community Champion
February 23, 2018

Dear @CRM Support,

then you have discovered a bug or an anomaly in the REST. When you tell me your exact Jira version, I will try to clarify this.

But you can do this on your own with the support, too.

So long

Thomas

Danyal Iqbal
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.
February 26, 2018

To explain regarding the different behavior by the fields in JIRA:

Navigable: Possible to see the field in the issue navigator 
Orderable: Possible to place it on "screens".

  • Field with no 'Orderable' value, will not be able to be visible in the 'Screens' in JIRA

In order to identify which fields has what value for this two property, run the following in your browser's URL:

http://<YOUR JIRA URL>/rest/api/2/field

This will return an API result for all the fields available in your instance, together with the orderable and navigable value. To find the field that is not orderable, simply find for "orderable":false.

I did some testing and everything works as expected. There is no bug-atleast in v7.5. Rest API does in fact follow the UI rules.

CRM Support February 27, 2018

Hi Danyal, 

 

Thanks for your comments. The JIRA version that we are using is JIRA v7.2.8  . I tried to match the fields from the REST response on view JIRA issue with the response from http://<YOUR JIRA URL>/rest/api/2/field . The values for Orderable : true appears for most of the fields that are not shown in UI. 

Thanks.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events