I'm writing a script that returns a list of custom endpoints. I'm retrieving the list of endpoints with the following code
import com.onresolve.scriptrunner.runner.RestEndpointManager
import com.onresolve.scriptrunner.runner.util.OSPropertyPersister
List<Map> restEndpoints = OSPropertyPersister.loadList(RestEndpointManager.CONFIG_REST)
How would I find out what the rest URL is for each endpoint?
I've finally got this working.....
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.RestEndpointManager
import com.onresolve.scriptrunner.runner.util.OSPropertyPersister
import com.atlassian.plugin.ModuleDescriptor
import com.atlassian.plugin.Plugin
import com.atlassian.plugin.PluginAccessor
PluginAccessor pluginAccessor = ComponentAccessor.getPluginAccessor()
Plugin sr = pluginAccessor.getPlugin('com.onresolve.jira.groovy.groovyrunner')
ModuleDescriptor mdREM = sr.getModuleDescriptor('restEndpointManager')
RestEndpointManager restEndpointManager = (RestEndpointManager)mdREM.getModule()
List<Map> restEndpoints = OSPropertyPersister.loadList(RestEndpointManager.CONFIG_REST)
List<Map> endpoints = restEndpointManager.getEndpointsForDisplay(restEndpoints)
This gives me an endpoint list with each entry looking like this
{
"FIELD_NOTES": "contents of notes",
"FIELD_INLINE_SCRIPT": "// Source code here",
"FIELD_SCRIPT_FILE": "",
"canned-script": "com.onresolve.scriptrunner.canned.common.rest.CustomRestEndpoint",
"endpoints": [
{
"verb": "GET",
"name": "script_name",
"groups": [
"group 1",
"group 2"
],
"resourcePath": "Script99.groovy"
}
],
"id": "999999999",
"resourcePath": "Inline script"
}
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.