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!
This is not available OOTB. Some day ago I was using this macro
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:
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.