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

Copy page hierarchy in Confluence Server via REST API

Hi all,

I am trying to copy a page hierarchy from one space to another space via the Confluence REST API. In the Confluence Cloud API there exists

POST /wiki/rest/api/content/{id}/pagehierarchy/copy

(see https://developer.atlassian.com/cloud/confluence/rest/#api-content-id-pagehierarchy-copy-post).

 

On the server version I am getting a 404 error when trying to use this interface (note that authorization is not the problem). Is this functionality only available in the cloud version?

 

PS: In the cloud version it worked fine.

2 answers

0 votes
edwin Community Leader Dec 20, 2017

Hi,

For server it'll be 

POST /rest/api/content/{id}/pagehierarchy/copy

This is very misleading. There is no such api in Confluence Server.

@EdwinI tried to use the syntax you suggest, ie:

POST /rest/api/content/{id}/pagehierarchy/copy

 I get error 404. Using the python version, the syntax translates to:

url = "https://my.domain/confluence/rest/api/content/11111/pagehierarchy/copy"
headers = {"Content-Type": "application/json"}
payload = json.dumps( {  
"copyAttachments": True,  
"copyPermissions": True,  
"copyProperties": True,  
"copyLabels": True,  
"destinationPageId": "2222222",  
"titleOptions": {    
"prefix": "aaa",    
"replace": "",    
"search": ""  }} )
rrr = requests.request(   
   "POST",
   url,
   data=payload,
   headers=headers,   
   auth=("user", "password"),
)
print(rrr.text)

 The user I'm connected to has view page rights on the source space, and successfully created the destination space, using the relevant API. Logged in as that user, the copy operation works when using the UI.

I also tried with   "copyPermissions"False,  "copyProperties"False,  "copyLabels"False,

Hi,

I have the same need here (copy a page hierarchy to another space)... I've installed REST api browser, but it really seems like this function is not available on server ...

Any ideas, anyone?

Thanks,

Did you ever find it?

I have confluence 6.5.0.

I am looking for a way to copy the page hierarchy using a rest api, not the ui.

Ok, my bad. The api is private. I was looking at the public apis.

Like Rodrigo Silva likes this

Suggest an answer

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

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

8,465 views 6 6
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