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

Updating Confluence URL links using CLI Tool

Deleted user June 8, 2014

Hello,

We changed the URL to our confluence server and I wanted to update any hard links to the old URL with the new URL using the CLI tool. However I am running into problems.

I tried using the example on this page:
https://bobswift.atlassian.net/wiki/display/CSOAP/How+to+globally+search+and+modify+content


It works for me, however, when I try to edit all the spaces, it only edits the test page I created. So I'm not sure what I am doing wrong. This is the command I am running:

confluence --action runFromContentList --search "\"https://confluence.in.here.com\"" --space @all --common "--action modifyPage --id @pageId@ --findReplace \"https://wiki.ad.navteq.com/confluence#https://confluence.in.here.com\" --special \" #\" "



When I use the command to just "getContentList" it only returns the page I just created as a test as well as a different page in the same space:

C:\Users\lestrell\Desktop\atlassian-cli-3.8.0>confluenceprod --action getContent
List --search "\"https://confluence.in.here.com\""

2 results in list

"Id","Type","Title","URL","Excerpt"
"214302939","page","change","https://confluence.in.here.com/display/BSGS/change"
," ... aaa https://confluence.in.here.comá bbbb á ccc Testingá dddd"
"113934408","page","html macro","https://confluence.in.here.com/display/BSGS/htm
l+macro"," ... font color=""red"" size=""3""><strong>Wiki URL has changed to ""h
ttps://confluence.in.here.com"". <a href=""https://confluence.in.here.com/displa
y/HELP/Upgradeto5.5andMigrationtoaHERE.comURL""> Click here</a> for more informa
tion.</strong></font> </center> <center ... "



So, I'm not sure what I am doing wrong. Can anyone help?

2 answers

1 accepted

1 vote
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
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.
June 8, 2014

Search uses Confluence text search, so you can go to the UI and conduct the same search. See how many hits you get? I suspect you really want to find links that will be broken with the change. There probably isn't a way to subset pages that have the link. So, that means doing all pages.

Deleted user June 9, 2014

OK, when I go to the UI I only get one page result as well. Yes, I wanted to udpated any broken link that was in any and all pages...I guess that is not possible?

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
June 9, 2014

No, it just means it will be slow doing the change for all pages. Perhaps do a space at a time. Same approach as before, but not using search. Instead, use runFromPageList with --space XXX. This will go through each page in the space and attempt the findReplace. If nothing is found, the page should not be updated (verify this on a few of your pages first if you like). It takes a lot longer since each page must be downloaded.

Deleted user June 9, 2014

Great, thank you so much for your help Bob. I appreciate it.

Ian Burbo August 11, 2014

I've been trying to complete this same task with no results. It is basically the same step listed here as exmaple 1:

https://bobswift.atlassian.net/wiki/display/CSOAP/How+to+globally+search+and+modify+content

confluence.sh --action runFromPageList --space "RDAISC" --common "--action modifyPage --id @pageId@ --findReplace \"http://wiki.ad.navteq.com/confluence#http://confluencedev.in.here.com\" --special \" #\" "

The interesting thing is that I can get this to replace any normal text on a page, but it will not alter the URL in anchor tags. Any thoughts?

Bob Swift OSS (Bob Swift Atlassian Apps)
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.
August 11, 2014

Take a look at an example page's storage format and verify the text matches your find string. Next simplify and run just against the example page and use --debug on the action and see if that helps you see what is going on. Open an issue if you have problems and provide the log.

0 votes
Deleted user June 9, 2014

OK, when I go to the UI I only get one page result as well. Yes, I wanted to udpated any broken link that was in any and all pages...I guess that is not possible?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events