The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

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

Andrea Vivaldi
November 7, 2018

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Lava Kumar Dukanam _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
November 8, 2018

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

Andrea Vivaldi
November 8, 2018

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

Smita
August 23, 2019

Does it work for Cloud Space export?

Like Paul J. Hecker likes this
TAGS
AUG Leaders

Atlassian Community Events