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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.