public class ConfluenceClient extends Object
ConfluenceClient class
This class is intended to be used to interact with Confluence REST API
There are some methods that make use of the Confluence JSON-RPC 2.0 API, but until all the methods are ported to the new REST API, we will have to use them to leverage all the features provided by Confluence
| Constructor and Description |
|---|
ConfluenceClient(String protocol,
String host,
Integer port,
String path,
String username,
String password)
Creates a new client instance using the given parameters
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
check()
Check method used to test if Confluence instance is up and running
|
boolean |
checkAuth()
Check method used to test if Confluence instance is up and running when using Authority connector (JSON-RPC API)
|
void |
close()
Close the client.
|
Attachment |
getAttachment(String attachmentId)
Gets a specific attachment contained in the specific page
|
List<Label> |
getLabels(String pageId)
Get the labels of a specific page
|
Page |
getPage(String pageId)
Get a Confluence page identified by its id
|
ConfluenceResponse<Attachment> |
getPageAttachments(String pageId)
Get the attachments of the given page
|
ConfluenceResponse<Attachment> |
getPageAttachments(String pageId,
int start,
int limit)
Get the attachments of the given page using pagination
|
ConfluenceResponse<Page> |
getPages()
Get a list of Confluence pages
|
ConfluenceResponse<Page> |
getPages(int start,
int limit,
com.google.common.base.Optional<String> space)
Get a list of Confluence pages using pagination
|
ConfluenceUser |
getUserAuthorities(String username) |
public ConfluenceClient(String protocol, String host, Integer port, String path, String username, String password) throws ManifoldCFException
Creates a new client instance using the given parameters
protocol - the protocolhost - the hostport - the portpath - the path to Confluence instanceusername - the username used to make the requests. Null or empty to use anonymous userpassword - the passwordManifoldCFExceptionpublic void close()
Close the client. No further requests can be done
public boolean check()
throws Exception
Check method used to test if Confluence instance is up and running
Boolean indicating whether the Confluence instance is alive or notExceptionpublic boolean checkAuth()
throws Exception
Check method used to test if Confluence instance is up and running when using Authority connector (JSON-RPC API)
This method will be deleted when all JSON-RPC methods are available through the REST API
Boolean indicating whether the Confluence instance is alive or notExceptionpublic ConfluenceResponse<Page> getPages() throws Exception
Get a list of Confluence pages
ConfluenceResponse containing the result pages and
some pagination valuesExceptionpublic ConfluenceResponse<Page> getPages(int start, int limit, com.google.common.base.Optional<String> space) throws Exception
Get a list of Confluence pages using pagination
start - The start value to get pages fromlimit - The number of pages to get from startConfluenceResponse containing the result pages and
some pagination valuesExceptionpublic ConfluenceResponse<Attachment> getPageAttachments(String pageId) throws Exception
Get the attachments of the given page
pageId - the page idConfluenceResponse instance containing the attachment results and some pagination valuesExceptionpublic ConfluenceResponse<Attachment> getPageAttachments(String pageId, int start, int limit) throws Exception
Get the attachments of the given page using pagination
pageId - the page idstart - The start value to get attachments fromlimit - The number of attachments to get from startConfluenceResponse instance containing the attachment results and some pagination valuesExceptionpublic Attachment getAttachment(String attachmentId)
Gets a specific attachment contained in the specific page
attachmentId - pageId - Attachment instancepublic Page getPage(String pageId)
Get a Confluence page identified by its id
pageId - the page idpublic List<Label> getLabels(String pageId)
Get the labels of a specific page
pageId - The pageId to get the labelsList<Label> of labelspublic ConfluenceUser getUserAuthorities(String username) throws Exception
username - Exception