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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,551,667
Community Members
 
Community Events
184
Community Groups

Confluence REST API - Copy page hierachy

Hi,

 

I use the rest api call to duplicate page hierarchy (parent & child pages) from a origin space to destination space.

 

curl --request POST \

--url 'https://your-domain.atlassian.net/wiki/rest/api/content/{id}/pagehierarchy/copy' \ --user 'email@example.com:<api_token>' \

--header 'Accept: application/json' \ --header 'Content-Type: application/json' \

--data '{

"copyAttachments": true,

"copyPermissions": true,

"copyProperties": true,

"copyLabels": true,

"copyCustomContents": true,

"copyDescendants": true,

"destinationPageId": "<string>",

"titleOptions": {

                        "prefix": "<string>",

                        "replace": "<string>",

                        "search": "<string>"

                          }

}'

I use example from Confluence rest api catalog and in the part titleOptions it has 3 properties:

prefix --> I understand that I that to prefix title to allow to copy parent and child pages

 

Could you explain me what is the purpose of "Search" and "replace"  properties?

 

Thank you

 

Cedric

 

1 answer

1 accepted

0 votes
Answer accepted
David Bakkers
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 Leaders.
May 15, 2023 • edited

Hello @CEDRIC DEVAUX 

Those two properties are for searching and replacing words from the titles of the source pages when copying pages in the same space, since Confluence doesn't allow two pages in the same space to have the same title.

For example, if all the titles of the source pages contained the word "dogs" and you wanted all the titles of all the copied pages to use the word "cats" instead, you'd use:

  "titleOptions": {
    "search": "dogs",
"replace": "cats" }

Combined with the prefix property, it gives you a bit more flexibility in ensuring pages copied into the same space have unique titles.

Hello David,

Thank you, it's very clear 

Like David Bakkers likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events