Hello all,
I am trying to using Scriptrunner (inside of Jira Service Desk) to communicate to Confluence (linked application) and create a Confluence space.
So far I have:
1. Parse Jira Service Desk ticket.
2. Use Rest API to pass assign some values in creating a Confluence space (title, key, description, etc.)
The main issue that I am having is that the API does not let me pass/set admins for the space upon creation. Is there something in the API that allows me to do this? What I have read is there is not and one alternative method is using Rest Endpoints (on the Confluence side) to wait and listen for actions to happen (in this case when the space is created.
The ideal solution would be to allow me to parse the Jira Service Desk ticket, pass the admins as a parameter, and set the admins for the Confluence space upon creation of the space.
So far, to my knowledge, I have a good understanding of this, and this is my current implementation, just a snippet of what is important:
def params = [
type : "global",
name: spaceName,
key: someKey, // set the space key (in Confluence - or retrieve it from the Jira ticket
description: [
plain: [
value: someDescription
]
]
]
authenticatedRequestFactory
.createRequest(Request.MethodType.POST, "rest/api/space")
.addHeader("Content-Type", "application/json")
.setRequestBody(new JsonBuilder(params).toString())
.execute(new ResponseHandler<Response>() {
@Override
void handle(Response response) throws ResponseException {
if (response.statusCode != HttpURLConnection.HTTP_OK) {
throw new Exception(response.getResponseBodyAsString())
} else { "... do some other stuff"
Any help would be greatly appreciated, thank you!