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
| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
proxyHost |
protected java.lang.String |
proxyPassword |
protected int |
proxyPort |
protected java.lang.String |
proxyProtocol |
protected java.lang.String |
proxyUsername |
| 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,
int socketTimeout,
int connectionTimeout,
java.lang.String proxyUsername,
java.lang.String proxyPassword,
java.lang.String proxyProtocol,
java.lang.String proxyHost,
int proxyPort)
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> |
getPageChilds(int start,
int limit,
java.lang.String pageId) |
ConfluenceRestrictionsResponse<Restrictions> |
getPageReadRestrictions(int start,
int limit,
java.lang.String pageId) |
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
|
ConfluenceResponse<Page> |
getSpaceRootPages(int start,
int limit,
java.lang.String space,
com.google.common.base.Optional<java.lang.String> pageType) |
ConfluenceResponse<Space> |
getSpaces(int start,
int limit,
com.google.common.base.Optional<java.lang.String> spaceType,
com.google.common.base.Optional<java.lang.String> spaceStatus) |
ConfluenceUser |
getUserAuthorities(java.lang.String username) |
ConfluenceResponse<Group> |
getUserGroups(int start,
int limit,
java.lang.String username) |
protected java.lang.String proxyUsername
protected java.lang.String proxyPassword
protected java.lang.String proxyProtocol
protected java.lang.String proxyHost
protected int proxyPort
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,
int socketTimeout,
int connectionTimeout,
java.lang.String proxyUsername,
java.lang.String proxyPassword,
java.lang.String proxyProtocol,
java.lang.String proxyHost,
int proxyPort)
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> getSpaceRootPages(int start, int limit, java.lang.String space, com.google.common.base.Optional<java.lang.String> pageType) throws java.lang.Exception
start - limit - space - pageType - java.lang.Exceptionpublic ConfluenceResponse<Page> getPageChilds(int start, int limit, java.lang.String pageId) throws java.lang.Exception
java.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) throws java.lang.Exception
Gets a specific attachment contained in the specific page
attachmentId - Attachment instancejava.lang.Exceptionpublic Page getPage(java.lang.String pageId) throws java.lang.Exception
Get a Confluence page identified by its id
pageId - the page idjava.lang.Exceptionpublic ConfluenceRestrictionsResponse<Restrictions> getPageReadRestrictions(int start, int limit, java.lang.String pageId) throws java.lang.Exception
java.lang.Exceptionpublic 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.Exceptionpublic ConfluenceResponse<Group> getUserGroups(int start, int limit, java.lang.String username) throws java.lang.Exception
java.lang.Exceptionpublic ConfluenceResponse<Space> getSpaces(int start, int limit, com.google.common.base.Optional<java.lang.String> spaceType, com.google.common.base.Optional<java.lang.String> spaceStatus) throws java.lang.Exception
java.lang.Exception