I want to create a space in Confluence programmatically and add a banner to the space at the same time. I do not see that option in the REST API. Am I missing it? We are using Data Center. Thanks
Hi @Bill Brinkley
I hope you are well.
I don't think there's an API method to customize the Space layout, such as a header.
However, you might be able to get a similar result by running the same request from the UI through an automation.
Here's an example of creating a Space and then setting the header to a Panel Macro.
CONFLUENCE_BASE_URL=http://localhost:27180/c7180
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin
NEW_SPACE_KEY=TESTSPACE
NEW_SPACE_NAME="Test Space"
NEW_SPACE_HEADER_PANEL='{panel:borderStyle=dashed|borderColor=blue|titleBGColor=#00a400|titleColor=white|bgColor=#72bc72}This is a Test Space{panel}'
# Create the Space
curl -v -o /dev/null -X POST -u ${ADMIN_USERNAME}:${ADMIN_PASSWORD} \
${CONFLUENCE_BASE_URL}'/rest/api/space' \
-H 'Content-Type: application/json' \
-d '{"key": "'${NEW_SPACE_KEY}'", "name": "'${NEW_SPACE_NAME}'"}'
# Adjust the Header
curl -v -o /dev/null -X POST -u ${ADMIN_USERNAME}:${ADMIN_PASSWORD} \
${CONFLUENCE_BASE_URL}'/spaces/docustompagecontent.action' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'X-Atlassian-Token: no-check' \
-d 'sidebarText=' \
--data-urlencode headerText="${NEW_SPACE_HEADER_PANEL}" \
-d 'footerText=' \
-d 'key='${NEW_SPACE_KEY} \
-d 'confirm=Save'
This will result on the following Space.
Kind regards,
Thiago Masutti
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.