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

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

Reading confluence page.

My project uses Atlassian Confluence 6.8.3 and What I am looking for is to read a confluence page with the URL provided, I am trying to build desktop utility which will read confluence content and does the necessary changes in S3 storage. is it possible to read the confluence content with just URL of the page? Please do let me know your thoughts.

I am trying to achieve this using java.

Thanks in advance, I am looking forward to the best solution.

Shiva.

 

1 answer

Hi, you can read confluence page with the URL. It will be in HTML format so you need to use HTML tags for finding content. You need to integration user to read pages and this user needs  view permission to get the content.

@Burak Kocak Thanks for responding. Can you give any code snippet reference that can help me out?

@Burak Kocak The examples over here use the url something like this https://hostname/rest/api/content/id but i have plain url like this 

https://hostname/display/spacename/pagename. I would like to read content from this url.

 

Thanks,

Shiva.

So you can split the URL  its easy to split like

String url = "https://hostname/display/spacename/pagename";
String[] url1 = url.split("https://hostname/display/");
String[] url2 = url1.split("/"); String spKey = url2[0]; //spacekey
String pName = url2[1] ; //pagename

and get the pagename and use rest below ( there is url class in java but use have to split it again). It will return a json, and you can get the page id in it . Then you can use it in

https://hostname/confluence/rest/api/content?title=pagename

now we have page id and

https://hostname/rest/api/content/pageid?expand=body.storage

Returned json will have the content of the page.

You will get lots of problems with this way, because of the spaces and other characters as will harder to work while spliting.

It's better to ask pageid from the user. When the page name changed pageid still same thus it will have a consistency. On the other hand if your user use ASCII char in the name, page URL turn to https://hostname/confluence/pages/viewpage.action?pageId=xxxxxxxx way.

Did this work for you Poreddy. Can you share the code snippet

Suggest an answer

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

🏑 Atlympic Event: Confluence

Hello Community!  Quick disclaimer: We are running a contest on Community (The Atlympics!) from July 23rd - August 8th of 2021. If you are interested in participating in this contest (prizes! ...

193 views 6 8
Read article

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