Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,295,678
Community Members
 
Community Events
165
Community Groups

Can you programmatically create a banner for a Confluence space?

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

1 answer

0 votes

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.

test-space.png

 

Kind regards,
Thiago Masutti

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
7.13.2
TAGS
Community showcase
Published in Confluence

Confluence: Where work and wellness meet

Feeling overwhelmed by the demands of work and life? With a 25% increase in the prevalence of anxiety and depression worldwide during the pandemic, for most of us, it’s a resounding yes . 🙋‍♀️ ...

937 views 14 27
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you