The Nuxeo Java Client is a Java client library for Nuxeo REST API.
It is compatible with all Nuxeo versions as of LTS 2021.
Getting Started
Follow this tutorial to have a running Nuxeo instance on your local machine.
Installation
To use nuxeo-java-client, you can download it from our Nexus: Nuxeo Client Library 4.0.0.
If you use Maven, you need to have nuxeo-java-client as dependency:
<dependency>
<groupId>org.nuxeo.client</groupId>
<artifactId>nuxeo-java-client</artifactId>
<version>4.0.0</version>
</dependency>
<repository>
<id>public-releases</id>
<url>https://packages.nuxeo.com/repository/maven-public</url>
</repository>
Client Creation
Nuxeo Java Client is created with help of its Builder
. Once every options are submitted, last step is to build the client and test the connection to Nuxeo Server:
NuxeoClient client = new NuxeoClient.Builder()
.url("http://localhost:8080/nuxeo")
.authentication("Administrator", "Administrator")
.schemas("*") // fetch all document schemas
.connect();
Client is now ready to execute requests to Nuxeo Server. After its creation, it will contain the current Nuxeo user and the Nuxeo Server version.
More documentation about client options.
build
instead of connect
to not perform any request to check the authentication.
Fetch Your First Document
Below is how we can retrieve default domain from a stock Nuxeo Server:
Document domain = client.repository().fetchDocumentByPath("/default-domain");
String title = domain.getPropertyValue("dc:title"); // should be equal to "Domain"
Compatibility
The 4.0 Nuxeo Java Client version is compatible with Java 11 and greater.