How can I get fields present on screen via REST API

How can I get fields present on screen via REST API?

There is an REST API https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-screens/#api-rest-api-2-screens-get for getting screen fields bu it is not returning fileds available on screen.

2 Likes

As far as I remember, you need to call Get all screen tabs and then Get all screen tab fields. In case when you have multiple tabs, you need to iterate over them.

Let us know if it helps you.

1 Like

Please give me a minute as I need to embrace, the pace of you response time.

2 Likes

If I want to get editable fields for project then:

  1. For ProjectId I get a collection of IssueTypeId https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-type-schemes/#api-rest-api-3-issuetypescheme-project-get
  2. For each IssueTypeId I get a collection of ScreenScheme https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-type-screen-schemes/#api-rest-api-3-issuetypescreenscheme-get
  3. For each ScreenScheme I get a collection of Screen. Here I can decide which of them are editable. Defualt screen If only once screen or edit Screen if multiple of them? https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-screen-schemes/#api-rest-api-3-screenscheme-get
  4. For each Screen I get a collection of ScreenTab https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-screen-tabs/#api-rest-api-2-screens-screenid-tabs-get
  5. For each ScreenTab I get a collection of Fields https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-screen-tabs/#api-rest-api-2-screens-screenid-tabs-get
1 Like

Iā€™m not sure if we understand in the same way the response of get screen schemes endpoint and the meaning of editable.

From what I know, these values edit, view, and create respond to a question - which screen should be displayed on the issue edit screen, issue view and issue create screen. If these values are not listed, the default screen is used.

There is a high chance that when a field is not present on the edit screen you canā€™t modify it via edit issue, but Iā€™m happy to confirm that. :slight_smile:

1 Like

Confirmed, you canā€™t modify the field if itā€™s not on the screen neither via UI nor via REST API.

To summarise,
if screen scheme API returns:

 {
      "id": 10032,
      "name": "Office screen scheme",
      "description": "Manage office data",
      "screens": {
        "default": 10020
      }
   }

Only fields that are on the screen with id 10020 can be edited.

When the response is:

{
      "id": 10010,
      "name": "Employee screen scheme",
      "description": "Manage employee data",
      "screens": {
        "default": 10017,
        "edit": 10019,
        "create": 10019,
        "view": 10020
      }
    }

the default doesnā€™t matter, because for every ā€œtypeā€ view we have different screens declared, so you can edit fields from screen 10019.

When the response is:

{
      "id": 10010,
      "name": "Employee screen scheme",
      "description": "Manage employee data",
      "screens": {
        "default": 10017,
        "create": 10019,
        "view": 10020
      }
    }

No edit in the response - then fields that are on the default screen can be modified.

2 Likes

Great! I am very thankful :slight_smile:

How about next-project? How can we get editable/viable fields on nextgen projects?

Team-managed project configuration is out of the scope of my knowledge :stuck_out_tongue:
Iā€™ve pinged a team, which can have broader knowledge.
I hope they will help.

Beata,
Did the team managed to help?

Here is what I get from the team. I hope it helps.

Thereā€™s no particular API which people can use to fetch fields in a screen for Next-gen. Because Next-gen fields are all ā€œinline-editableā€ so customers can use the editMetadata REST API to fetch all ā€œeditableā€ fields in Next-gen as a workaround.

1 Like

@BeataSzturemska API Get edit issue metadata is for a particular issue only. Itā€™s not possible to get all editable fields for whole project (for issue type in a project).

Thereā€™s a call Get create issue metadata which returns fields for the create issue screens for all issue types in the requested project.

Do not know differences between ā€œGet create issue metadataā€ and ā€œGet edit issue metadataā€, i.e. when some fields may be missing in one of them only. Can you clarify that?

I miss some system fields, e.g. Status, in results of both of these calls.

Update 2024: ā€œGet create issue metadataā€ is deprecated and replaced by 2 new API endpoints, see https://developer.atlassian.com/cloud/jira/platform/changelog/#CHANGE-1304

For number 5 the correct link is: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-screen-tab-fields/

@BeataSzturemska any chance to get this work for JSM projects? So far, some endpoints described by @bartlomiej.janczak are restricted to ā€œclassic projectsā€ only.

Maybe there is already a ticket?

This solution works only for admins. Normal users receive an error: ā€˜Only Jira administrators can access the issue type screen schemes.ā€™

I tried to achieve this using OAuth 2.0 authentication and granular permissions. I was hopeful that read operations would be allowed, but unfortunately, I still encountered the same error.

Is there another solution?