Bulk add labels to Confluence cloud via REST API
When to use this article
This article may be used any time there is a need to bulk add labels to the Confluence Cloud site.
Prepare data
- Postman installed on your computer Download Postman | Get Started for Free
- Confluence Cloud instance
- Site admin user
- API Token generated on https://id.atlassian.com/manage-profile/security/api-tokens for the site admin user in the step above
- Space list CSV file generated on Governator by using the query below.
select contentid from content where content_type = 'page' and prevver is not null
Set up Postman
This section may be skipped if:
Download the files below on your computer.
Add labels to space.postman_environment.json
Postman Collection Run
Import them to Postman.
- Select environment variables.
Click on the environment drop-down button on the top right corner of Postman.
Select Add labels to space from the list.
- Set environment variables.
Click on the Environment quick look button on the top right corner of Postman
Click on the Edit button
Fill out the Current Value column with the information below.
site-name → If your site address is mysite.atlassian.com type mysite
username → Email address that you created API Token with.
api-token → Token that you created on https://id.atlassian.com/manage-profile/security/api-tokens
limit → Do not change this value.
subject-type → If you would like to grant a user on all spaces type user, or type group if you would like to grant a group.
subject-identifier → If you would like to grant a user type their email address or the name of the group.
Click on the Save button.
Click on the View More Actions button next to the Bulk add labels project and select Run collection
- Make sure the Add label script is checked.
- Optional: In order to view logs generated during the run, you can click on the Console button on the left bottom side of the Postman.
Select the contentid list file generated as explained in the Requirements.
Click on the Select File button.
Select the CSV file that includes the space list.
Click on the Run Add labels to space in Bulk button.
Once it completes running, the Stop Run button should disappear.
Please find the attached video for reference: