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/c7180ADMIN_USERNAME=adminADMIN_PASSWORD=adminNEW_SPACE_KEY=TESTSPACENEW_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 Spacecurl -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 Headercurl -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
It looks like you're new here. Sign in or register to get started.