Label details not showing in page storage format of Confluence page
Asked by Arya Soman:

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.

<br />

Thank you!  
Regards  
Arya


Answers:
author: Aron Gombas _Midori_
body: 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.

comments: author: Arya Soman
body: 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


author: Aron Gombas _Midori_
body: Why don't you use the dedicated action called *Add Label* instead of working with these low-level JSONs?


author: Arya Soman
body: 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.


author: Aron Gombas _Midori_
body: 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.


author: Arya Soman
body: 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.


author: Aron Gombas _Midori_
body: 404 suggests that the page cannot be accessed. Either ID is wrong or the authentication credentials are wrong.


author: Arya Soman
body: We are using the same authentication credentials as we used for page creation.


author: Aron Gombas _Midori_
body: 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?


author: Arya Soman
body: Yes we are passing the ID of newly created page. Like this.

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


author: Aron Gombas _Midori_
body: 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"!


author: Arya Soman
body: Thank you for the help, now its working.


Tags: confluence-server

server