Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Any way to programatically make a full XML export of a space

Hi,

is there any way to programatically make (via REST API or groovy script) a full XML export of a Confluence space, in the same way you can do it via web GUI?

In that case, where can I see some examples?

I need to script via cronjob this task, not doing it manually via GUI.

 

Thanks

Andrea

1 answer

1 accepted

Hi @Andrea Vivaldi,

It appears like there's no API that can export a confluence space.
You can support this request here : https://jira.atlassian.com/browse/CONFSERVER-40457

I also found a python script (>3.0) by Stephen Deutsch

import requests
import shutil
from time import sleep
from requests import Session
from requests.auth import HTTPBasicAuth
from zeep import Client
from zeep.transports import Transport

user = "admin"
password = "admin"

session = Session()
session.auth = HTTPBasicAuth(user, password)
client = Client('http://localhost:1990/confluence/rpc/soap-axis/confluenceservice-v2?WSDL',
transport=Transport(session=session))

print("Logging in...")
token = client.service.login(user, password)
print("Getting Spaces")
spaces = client.service.getSpaces(token)
numSpaces = len(spaces)
for index, space in enumerate(spaces):
print("Exporting space {} of {} - {} using URL:".format(index+1, numSpaces, space.key))
siteExportUrl = client.service.exportSpace(token, space.key, "TYPE_XML")
print(siteExportUrl)
filename = siteExportUrl.split('/')[-1]
print("Saving as: " + filename)
r = session.get(siteExportUrl, stream=True)
with open(filename, 'wb') as f:
shutil.copyfileobj(r.raw, f)
sleep(5)

Hope this helps!

Thanks,

Lava

Thank you very much Lava! It's what I am looking for.

Does it work for Cloud Space export?

Like Paul J_ Hecker likes this

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

494 views 24 9
Join discussion

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