Confluence REST Client

REST Client for interact with Confluence wiki

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.github.lucapino
ArtifactId

ArtifactId

confluence-rest-client
Last Version

Last Version

1.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

Confluence REST Client
REST Client for interact with Confluence wiki
Project URL

Project URL

https://github.com/lucapino/confluence-rest-client
Source Code Management

Source Code Management

https://github.com/lucapino/confluence-rest-client.git

Download confluence-rest-client

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.lucapino/confluence-rest-client/ -->
<dependency>
    <groupId>com.github.lucapino</groupId>
    <artifactId>confluence-rest-client</artifactId>
    <version>1.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.lucapino/confluence-rest-client/
implementation 'com.github.lucapino:confluence-rest-client:1.0.4'
// https://jarcasting.com/artifacts/com.github.lucapino/confluence-rest-client/
implementation ("com.github.lucapino:confluence-rest-client:1.0.4")
'com.github.lucapino:confluence-rest-client:jar:1.0.4'
<dependency org="com.github.lucapino" name="confluence-rest-client" rev="1.0.4">
  <artifact name="confluence-rest-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.lucapino', module='confluence-rest-client', version='1.0.4')
)
libraryDependencies += "com.github.lucapino" % "confluence-rest-client" % "1.0.4"
[com.github.lucapino/confluence-rest-client "1.0.4"]

Dependencies

compile (8)

Group / Artifact Type Version
org.apache.httpcomponents : httpclient jar 4.5.3
org.apache.httpcomponents : httpmime jar 4.5.3
com.google.code.gson : gson jar 2.8.2
org.apache.commons : commons-lang3 jar 3.6
javax.ws.rs : jsr311-api jar 1.1.1
commons-io : commons-io jar 2.6
commons-validator : commons-validator jar 1.6
org.slf4j : slf4j-api jar 1.7.25

runtime (1)

Group / Artifact Type Version
ch.qos.logback : logback-classic jar 1.2.3

test (1)

Group / Artifact Type Version
org.testng : testng jar 6.11

Project Modules

There are no modules declared in this project.

ConfluenceRestClient

A simple Java Client to communicate with the Confluence REST API.

Version

Current release: 1.0.4

This is a reworked version of ConfluenceRestClient.
This version decouples the HTTP-specific code from the Confluence client code so that it is possible, for example, to implement the client using other third party libraries, or using a different form of authentication).
This version also separates the API (now in the xxx.api package) from the implementation (in the xxx.impl package).

Usage

You must first get a RequestService to perform REST calls.
One called HttpAuthRequestService is provided, which uses Basic HTTP authentication.
Then connect using the URI of the Confluence server and your credentials:

HttpAuthRequestService requestService = new HttpAuthRequestService();
requestService.connect(new URI("https://example.com"), "admin", "admin");

You can then create the client factory, providing the RequestService, an ExecutorService, and an APIUriProvider that configures the Confluence REST end point:

ExecutorService executorService = Executors.newCachedThreadPool();
APIUriProvider uriProvider = new APIUriProvider(new URI(conf.getBaseUrl() + "/confluence"));
ClientFactory factory = new ClientFactoryImpl(executorService, requestService, apiConfig);

With this factory you can then create one of four separate clients for the different parts of the REST API:

  • SpaceClient
  • UserClient
  • ContentClient
  • SearchClient

To create an interface for working with content:

ContentClient contentClient = clientFactory.getContentClient();
List<String> expand = new ArrayList<>();
expand.add(ExpandField.BODY_VIEW.getName());
expand.add(ExpandField.BODY_STORAGE.getName());
Future<ContentBean> future = contentClient.getContentById(123456, 0, expand);
ContentBean content = future.get();
...

License

Copyright 2016 Micromata GmbH
Modifications Copyright 2017 Martin Böhmer
Modifications Copyright 2017 Mikkel R. Jakobsen
Modifications Copyright 2017-2018 Luca Tagliani

Licensed under the Apache License, Version 2.0 (the "License"); you may not use these files except in compliance with the License.
You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.

Versions

Version
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0