You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.
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,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Danilo Yasushi Saita , which version of Confluence are you using? It's now possible to copy page hierarchies, since 6.0 https://confluence.atlassian.com/doc/confluence-6-0-release-notes-844235309.html#Confluence6.0ReleaseNotes-6-0-2
For previous releases, you can use the addon https://marketplace.atlassian.com/apps/22929/copy-page-tree?hosting=server&tab=overview
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.
I have confluence 6.5.0.
I am looking for a way to copy the page hierarchy using a rest api, not the ui.
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.
I have confluence 7.13.2
@Danilo Yasushi SaitaDid you find a way to copy the page hierarchy using a rest api on the server version ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
For server it'll be
POST /rest/api/content/{id}/pagehierarchy/copy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is very misleading. There is no such api in Confluence Server.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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,
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.
Hi, I'm using this command below and this works completely fine
import requests
import json
url = 'https://mydomain.atlassian.net/wiki/rest/api/content/pageId/pagehierarchy/copy'
headers = {
'Content-Type': 'application/json',
}
payload = json.dumps({
"copyAttachments": True,
"copyPermissions": True,
"copyProperties": True,
"copyLabels": True,
"copyCustomContents": True,
"destinationPageId": "destinationPageId",
})
response = requests.post(
url, headers=headers, data=payload, auth=('myname@domain.com', 'PAT')
)
print(response.status_code)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Francis Vila were you ever successful in using that endpoint to copy a page hierarchy? If so, could you state the solution?
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.