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.
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.
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.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
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.
Did this work for you Poreddy. Can you share the code snippet
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.