How can I create a list of insight ITSM objects via script runner Endpoint API for dynamic dropdown atrtribut in Tempo API url?
The essence is to display the names of insight objects in the list of attributes when writing off time.
Insight comes pre-built with its own REST API endpoints.
You could just use the IQL Search endpoint
<jiraBaseUrl>/rest/insight/latest/iql/objects?iql=
But if you don't have the ability in the tempo to perform any transformation on the resulting data, then you can use the scriptrunner rest endpoint feature and the Insight IQL Java api to get just the list of objects and their label.
Something like
import com.onresolve.scriptrunner.runner.customisers.PluginModuleimport com.onresolve.scriptrunner.runner.customisers.WithPluginimport com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegateimport com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacadeimport groovy.transform.BaseScriptimport groovy.transform.Fieldimport javax.ws.rs.core.Response@WithPlugin('com.riadalabs.jira.plugins.insight') insightPlugin@BaseScript CustomEndpointDelegate delegategetInsightObjectForTempo(httpMethod: 'GET', groups: ['jira-users']) { @PluginModule IQLFacade iqlFacadedef objects = iqlFacade.findObjects('iql that returns the objecst you want') Response.ok(objects*.label).build()}
I don't know what format tempo expects, I don't use tempo, but if you need to convert the data to a different format, that wouldn't be very difficult.
It looks like you're new here. Sign in or register to get started.