Creating multiple Confluence Pages with dynamic content from Jira issues via Jira Automation and
Asked by Philip Kroos - TEAM XALT:

Hi community,

I'm trying to set up an Automation to achieve the following;

* I have an Epic in Jira with multiple child issues (stories) that are all in a specific sprint
* I want to create Confluence pages, with the Epic being the parent page and its title being the sprint name, sprint start date and sprint end date
* For each of the child issues, the automation should create a confluence page, with the title being the (child) issue's summary
* I would also like to set the labels of the created confluence pages based on field values of the jira issues. For example, if there is a fixversion "1.00", I want to automatically add a label to the confluence page named "release-1.00". The "release" part of the label is fixed, so if in a follow up sprint with new stories the fixversion is 1.01, the automation should create new pages with the label "release-1.01"

I managed to create the parent page (for the Epic) and the child pages (for each of the child issues/stories of the Epic) and I was also able to populate the confluence pages with content by using web requests. For example, I created a new variable in the automation and can use this variable to be included on the confluence pages of the child issues, so that they are correctly nested under the parent page. I followed the [official documentation here](https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-custom-content/#api-custom-content-post) and utilized the "custom data" section for the "web request body". In other words, the web request body to create the confluence pages sets aspects like the space where the confluence page should be created, the title, the parent etc.

However, I could not find any information on setting labels for confluence pages created via web requests from a Jira automation. Is there a way to set labels for confluence pages via Jira automation and the method of using web requests that I'm using?


Answers:
author: Darryl Lee
body: Hi [@Philip Kroos - TEAM XALT](/t5/user/viewprofilepage/user-id/3965067) - your automation sounds pretty cool!

To add labels, you have to use a v1 API endpoint:

* <https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content-labels/#api-wiki-rest-api-content-id-label-post>

It seems like the v1 Content Create endpoint would allow you to set labels (under the "metadata" section) when you create the page, but that endpoint is supposed tagged as deprecated:

* <https://developer.atlassian.com/cloud/confluence/rest/v1/api-group-content/#api-wiki-rest-api-content-post>

References:

* [How to add a label to a Confluence page using the v2 API?](https://community.atlassian.com/t5/Confluence-questions/How-to-add-a-label-to-a-Confluence-page-using-the-v2-API/qaq-p/2618944)
* [Creating a confluence page via rest api with a label](https://community.atlassian.com/t5/Answers-Developer-Questions/Creating-a-confluence-page-via-rest-api-with-a-label/qaq-p/469849)


author: Armin Meyer (Seibert - Coderay)
body: Hi Philip,

seems that Darryl provided the missing part.

I just want to add. If you don't mind using an App. We developed AutoPage that is pretty much designed for such use cases as yours.

In addition to the initial creation of a page the content stays always in sync with the jira issue or it can be defined at which time of the jira workflow the page will be updated.

If synchronization later on is not a point for you, your solution sounds valid too :)

[https://marketplace.atlassian.com/apps/1218503/autopage-create-confluence-page-from-jira-issue?tab=overview\&hosting=cloud](https://marketplace.atlassian.com/apps/1218503/autopage-create-confluence-page-from-jira-issue?tab=overview&hosting=cloud)

cheers

Armin


Tags: confluence

html

post

smart-value

variable

webhook