public class ConfluenceClient
extends java.lang.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(java.lang.String protocol,
java.lang.String host,
java.lang.Integer port,
java.lang.String path,
java.lang.String username,
java.lang.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(java.lang.String attachmentId)
Gets a specific attachment contained in the specific page
|
java.util.List<Label> |
getLabels(java.lang.String pageId)
Get the labels of a specific page
|
Page |
getPage(java.lang.String pageId)
Get a Confluence page identified by its id
|
ConfluenceResponse<Attachment> |
getPageAttachments(java.lang.String pageId)
Get the attachments of the given page
|
ConfluenceResponse<Attachment> |
getPageAttachments(java.lang.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<java.lang.String> space,
com.google.common.base.Optional<java.lang.String> pageType)
Get a list of Confluence pages using pagination
|
ConfluenceUser |
getUserAuthorities(java.lang.String username) |
public ConfluenceClient(java.lang.String protocol,
java.lang.String host,
java.lang.Integer port,
java.lang.String path,
java.lang.String username,
java.lang.String password)
throws org.apache.manifoldcf.core.interfaces.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 passwordorg.apache.manifoldcf.core.interfaces.ManifoldCFExceptionpublic void close()
Close the client. No further requests can be done
public boolean check()
throws java.lang.Exception
Check method used to test if Confluence instance is up and running
Boolean indicating whether the Confluence instance is alive or notjava.lang.Exceptionpublic boolean checkAuth()
throws java.lang.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 notjava.lang.Exceptionpublic ConfluenceResponse<Page> getPages() throws java.lang.Exception
Get a list of Confluence pages
ConfluenceResponse containing the result pages and
some pagination valuesjava.lang.Exceptionpublic ConfluenceResponse<Page> getPages(int start, int limit, com.google.common.base.Optional<java.lang.String> space, com.google.common.base.Optional<java.lang.String> pageType) throws java.lang.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 valuesjava.lang.Exceptionpublic ConfluenceResponse<Attachment> getPageAttachments(java.lang.String pageId) throws java.lang.Exception
Get the attachments of the given page
pageId - the page idConfluenceResponse instance containing the attachment results and some pagination valuesjava.lang.Exceptionpublic ConfluenceResponse<Attachment> getPageAttachments(java.lang.String pageId, int start, int limit) throws java.lang.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 valuesjava.lang.Exceptionpublic Attachment getAttachment(java.lang.String attachmentId)
Gets a specific attachment contained in the specific page
attachmentId - Attachment instancepublic Page getPage(java.lang.String pageId)
Get a Confluence page identified by its id
pageId - the page idpublic java.util.List<Label> getLabels(java.lang.String pageId)
Get the labels of a specific page
pageId - The pageId to get the labelsList<Label> of labelspublic ConfluenceUser getUserAuthorities(java.lang.String username) throws java.lang.Exception
username - java.lang.Exception