I was successful at creating a new page in the Script Console using the authenticatedRequestFactory simular as follows..
def myResponse
//create page
authenticatedRequestFactory
.createRequest(Request.MethodType.POST, "rest/api/content")
.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 {
myResponse = new JsonSlurper().parseText(response.responseBodyAsString)["page"]["id"]
}
}
})
I have had a real problem trying to add a new attachment to the new page using "rest/api/content/{id}/child/attachment" as I cannot figure out how to add the file to the request as in the format above?
My goal is to create a new Confluence page with attachment for each Jira issue as a post function. Retrieving the attachment from the jira issue is not a problem..just adding it to the newly created confluence page stumps me.
Any help would be greatly appreciated!
I would really like to know this as well. Is there a parameter to be added? Did you figure this out, perhaps?
The goal here for me is to create a confluence page from a Jira ticket using the tickets description and tickets attachment.
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.