Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Label details not showing in page storage format of Confluence page

Arya Soman May 31, 2023

Hi All,
We have created an automation to automatically create Confluence page whenever Jira issue got created.
For that we created a template in Confluence and added a label(tracker-record) to it.
With this template we created a sample page(where the label is automatically get added to the page) and copied the page storage format.
Then we converted the storage format to json and added that in our Jira Automation custom body to automatically create Confluence page using this template format.
But the information related to labels are not showing in the page storage format.
We were able to create the confluence page automatically whenever jira issue got created, but the labels (tracker-record)are not getting added to the pages as it is not there in the page storage format. Now we are adding the label manually.
The label details are not showing in the page storage format, even thought the labels are added in the page.

Is there any way to retrieve the label details so that we can add that in the custom body of our Automation.

Please help us to resolve this issue.


Thank you!
Regards
Arya

1 answer

1 accepted

0 votes
Answer accepted
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 31, 2023

As you noticed, labels are not part of the page's content and it is by design. Labels are entities that are added to the page, but they don't become part of that.

If you want to add the labels to the page from the automation, then you need to use the automation action that works with labels separately, in the next step after the page was created.

Arya Soman June 5, 2023

Hi,

Thank you for the suggestion. 

We tried to add the label information in Automation after creating the page.

For that we added the below code in our jira automation, after page creation.

"metadata": {

"labels": [

{ "prefix": "global",

"name": "tracker-label" }

]

}
The page is getting created but the label Information are not getting added.
Can you please help us on this.
Regards,
Arya
Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 6, 2023

Why don't you use the dedicated action called Add Label instead of working with these low-level JSONs?

Arya Soman June 6, 2023

We are using Jira Automation for Confluence page creation (ie create Confluence page when Jira issue got created) there Add Label action is not there and also in confluence datacenter Automation feature is not available.

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 6, 2023

Then you have to use the "Send web request" automation action to call this Confluence REST API end-point:

https://docs.atlassian.com/atlassian-confluence/REST/6.6.0/#content/{id}/label-addLabels

See the JSON at the end-point's doc. Yours is not correct, no need for "metadata" and such.

Arya Soman June 8, 2023

Tried this method after creating the page, but getting 404 error.

The user have the permission to view the content and we tried this method after creating the Confluence page(with same user itself) still getting 404 error.

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 8, 2023

404 suggests that the page cannot be accessed. Either ID is wrong or the authentication credentials are wrong.

Arya Soman June 8, 2023

We are using the same authentication credentials as we used for page creation.

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 8, 2023

Just to be sure, are you setting the ID of the newly created page to the second REST API call's URL to replace the {id} placeholder?

Arya Soman June 8, 2023

Yes we are passing the ID of newly created page. Like this.

http://example.com/rest/content/{pageid}label

Aron Gombas _Midori_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 8, 2023

Can you try this URL format?

https://example.com/rest/api/content/39747978/label

In our Confluence this is the URL that works. Note that I had to add "/api"!

Arya Soman June 8, 2023

Thank you for the help, now its working.

Like Aron Gombas _Midori_ likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events