Display labels of jira issue on confluence page

YaliZhang December 21, 2022

Hi,

I would like to implement a post function in order to automatically create a confluence page for the issue.

After the new page creation I find the labels of the issue are missing, now I try to link the labels of the confluence page to the labels of the issue. The labels of source issue can be automatically display on the confluence page.

Could you please suggest me how to do it?

Thankd a lot in advance

Best regards!

 

1 answer

0 votes
YaliZhang December 21, 2022
def contentId = contentResponse.id
def labelsBody = [
  [
    prefix : "global",
    name : "label-1"
  ],
[
    prefix : "global",
    name : "label-2"
  ],
]

authenticatedRequestFactory
    .createRequest(Request.MethodType.POST, "/rest/api/content/$contentId/label")
    .addHeader("Content-Type", "application/json")
    .setRequestBody(new JsonBuilder(labelsBody).toString())
    .execute(new ResponseHandler<Response>() {
    @Override
    void handle(Response response) throws ResponseException {
        if (response.statusCode != HttpURLConnection.HTTP_OK) {
            throw new Exception(response.getResponseBodyAsString())
        }
    }
})
Now I can create the labels for the confluence, but it not from the source issue automatically 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events