Currently when I use API call to get Insight objects, it returns lots of information besides the objects and attributes. I have to look up exactly what I need from the returns in order to do the rest of the work. The information returned from an API call is really overwhelming. Anyone has a good idea how to make the return data as simple as just return the value of the attribute?
Many thanks.
I don't think the Insight REST API has an equivalent to the "fields" filter that the Jira Issue API offers to only include the attributes you can about.
https://insight-javadoc.riada.io/insight-javadoc-8.6/insight-rest/#
You must either call the /object/{id} to get all the objects details, call /object/{id}/attributes to get just a list of attributes, or once you have a specific attribute id (unique to the object) then you can call /objectattribute/{id}
Be generally, with most modern languages you should be able to ingest the json into a structured object and then just fetch the necessary information.
For example, in groovy:
def parsedJson = New JsonParser().parseText(jsonStringFromObjectApiResponse)
//get an attribute value:
def attribute = parsedJson.attributes.find{it.objectTypeAttribute.name='ABC Attribute'}
def attributeValue = attribute.ObjectAttributeValues[0].value //this assumes the attribute holds a single string value
Hi Raiv, thanks for the response. We use REST API call to get a JSON, then parse to get data that we need. The difficulty here is the data returned from the REST API call contains too many information, and it takes lots of effort to develop the parse process, especially there are many objects we will need to develop the parse process in java/phythen. We expected that the REST API call should just return the information for the attributes that are defined in the object.
We will take a look the ScriptRunner page you provided. Thanks for that. We do use PSOTMAN to get API return too.
Wenping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Wenping Li
How are you using the API? From Jira automation rules or a ScriptRunner or any other tool. For retrieving the information by making a REST call you will get a JSON that you need to parse to get the information you are looking for.
If you are using ScriptRunner then take a look at this page for some information and sample scripts to make a REST call.
For testing REST endpoints I use Talend API test extension or POSTMAN.
I hope it helps.
Ravi
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.