How to get Insight custom fields with its objects from API?

javier_montilva August 30, 2021

Hi there.

Is there a way to get the Insight custom fields from my Jira's instance API with its objects according to their object schema?

E.g. I have the following Insight custom field named test and when I'm creating a new issue I can see all the objects available according the Object Schema that I selected in the configuration:

Screenshot from 2021-08-30 13-08-52.png

Is there a way to get this information (the Insight custom fields with its objects) from the API? I know that I can get all the objects from a specific schema by using the endpoint /iql/objects?iql=objectSchema="SCHEMA", but what I want to get is the custom fields with its objects.

 

Just in case, I'm using the following endpoint to get all the others custom fields from my instance: 

/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields

If a custom field has multiple values to choose, it will show me the field "allowedValues" with the values for the custom field, but this doesn't happen when it's an Insight custom field.

Can you guys give me a hand with this?

 

2 answers

0 votes
Georgi Gachev _Nemetschek Bulgaria_
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.
July 21, 2022

Hey guys,

Did you manage to find a way to do that? Or maybe there is something available right now, I tried searching for a solution but I couldn't find anything.

I need the same thing - I have a custom field that is using Insight and I would like to use REST calls to get the possible values (objects)?

Thanks,
Georgi

0 votes
Peter-Dave Sheehan
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, 2021

That's an interesting question.

It's possible that the IQL defined in the custom field context is only used for building the UI and not validated at all in the back end. This might imply Jira API will allow you to input any object via the rest API. I'm not even sure if the object key is validated to make sure it is valid.

But that still leaves you not knowing what are the possible values.

I checked and I can't find any public insight or Jira rest API that can give you the configuration for a custom field context (that would let you get the IQL so you could use the main insight API to get the list of objects).

I can find an internal insight API that can return the IQL, but you would first need to identify the correct config id for the issue context (project and issue type). But there are no public APIs for that either. 

The insight internal API is:

/rest/insight/1.0/customfield/default/<custom field context id>/connect

If you have Scriptrunner, you could create a custom Rest API that can use the JavaAPI to get this information.

javier_montilva August 30, 2021

Hey, thanks for your help! It's a shame that this is not possible. Do you know if this feature will be added someday?

Peter-Dave Sheehan
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, 2021

No clue. I'm just a user like you. Not in any Atlassian inner circle.

You might want to make a feature request.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events