labels in confluence

Nico de Jong April 25, 2018

heaving read the confluence manual I think that it isn't possible to change al pages with the label "X" to a page with the label "Y" in bulk

You can't remove, consolidate or manage labels directly. A labels are created by adding it to a page

Is my assumption correct or do I miss something? Is there perhaps feature request for this?

Thankx for reading/answering my question!

 

5 answers

4 accepted

2 votes
Answer accepted
Mirek
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 25, 2018

This is not available OOTB. Some day ago I was using this macro

https://bitbucket.org/stephendeutsch/confluence-user-macros/src/dc9180ae95e0292cba2b457c0215f071d39330c9/label%20management%20tool/?at=master

Not sure which version of Confluence you are having, but you can give it a try. If not this then maybe a plugin might be helpful. For example:

https://marketplace.atlassian.com/plugins/com.kostebekteknoloji.plugins.confluence.confluence-label-manager/server/overview

1 vote
Answer accepted
Christoffer Bromberg _K15t_
Contributor
April 25, 2018

You could search the pages via CQL and then set the new label via REST 

https://developer.atlassian.com/cloud/confluence/rest/#api-search-get, e.g. 

GET {{baseUrl}}/rest/api/content/search?cql=type = page and label in ('X')&expand=metadata.labels

and then set the new labels via https://developer.atlassian.com/cloud/confluence/rest/#api-content-id-put, e.g.

 PUT  {{baseUrl}}/rest/api/content/{{contentId}} with body 
{"type":"page",
"title": "Test page",
"metadata": {
"labels" : [
{ "prefix": "global",
"name": "Y" }
]
},
"version": { "number" : 2 }
}
}

 That could be scripted pretty easy using client-side code or scripting on the server, e.g. curl. You could even build a JS only plugin for that :)

This would work for server and cloud

Chela Wallace December 5, 2018

Would this work for doing a bulk change of labels across a space, specifically to change the underscore to a hyphen?

 

this_label  >> this-label

Christoffer Bromberg _K15t_
Contributor
December 5, 2018

Sure. You retrieve the old labels, exchange the label to exchange, and PUT them back as described above. You just need someone with some scripting experience - if you don't have access to such people in your org, ask your Atlassian Solution Partner, use one of the Apps mentioned below (or take the chance to learn it yourself :nerd:)

1 vote
Answer accepted
Christo Mastoroudes [Adaptavist]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2018

Hi Nico,

If you have the ScriptRunner for Confluence app you can do some bulk operations on  labels, or write your own script to help with managing labels.

Alternatively as Mirek mentioned, there are other apps available on the marketplace that could help. 

0 votes
Answer accepted
Stephen Deutsch
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 25, 2018

@Mirek Thanks for the mention on the label management tool. It will need to be installed as a user macro and then embedded in a page before you can use it.

In case you are using Confluence Cloud, you could also use the Bulk Action Tools Marketplace app to rename labels.

0 votes
Michele Lim [Cprime]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
November 27, 2018

Hey @Nico de Jong,

We have recently made a free plug in Power Scripts for Confluence which you can download from the Marketplace to help automate Confluence administration, one of the features is bulk label admin. Here's the script:

https://confluence.cprime.io/display/CTR/Replace+a+label+with+a+different+one

 

Hope this helps!

Michele

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events