Hi there,
I am able to read all groups from JIRA via the REST API.
Is there any way that I can also read the nested groups for each via REST?
Best regards,
George
There's no REST API for this, but you can easily implement your own REST endpoint with Script Runner for example. Then you can all it at rest/scriptrunner/1.0/custom/childgroups/?group=parent assuming your group that you want to examine is called parent.
here's the code:
import com.atlassian.jira.bc.group.GroupService; import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.user.ApplicationUser; import com.atlassian.jira.user.util.UserUtil; import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate import groovy.json.JsonBuilder import groovy.transform.BaseScript import javax.ws.rs.core.MultivaluedMap import javax.ws.rs.core.Response @BaseScript CustomEndpointDelegate delegate childgroups(httpMethod: "GET", groups: ["jira-users"]) { MultivaluedMap queryParams, String body -> def name = queryParams.get("group") def uu = ComponentAccessor.getComponent(UserUtil.class) def group = uu.getGroup(name) def gs = ComponentAccessor.getComponent(GroupService) return Response.ok(new JsonBuilder(gs.getChildGroupNames(group)).toString()).build(); }
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.