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.PluginModule
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import com.riadalabs.jira.plugins.insight.channel.external.api.facade.IQLFacade
import groovy.transform.BaseScript
import groovy.transform.Field
import javax.ws.rs.core.Response
@WithPlugin('com.riadalabs.jira.plugins.insight') insightPlugin
@BaseScript CustomEndpointDelegate delegate
getInsightObjectForTempo(httpMethod: 'GET', groups: ['jira-users']) {
@PluginModule IQLFacade iqlFacade
def 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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.