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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @David Bakkers , is there any trick to have more than one parameter being replaced?
Thanks a lot, Regards, Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Stefan Walther
Nope.
That endpoint only supports searching for one string in the titles of the source pages and replacing it with one string in titles of the copied pages.
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.