Introducing Nuxeo Java Client 1.0
As we constantly strive to make the Nuxeo Platform better and more efficient than ever, this time we turned our attention to the new REST API Java client.
The initial Java Automation Client fulfilled a lot of needs but there were two versions, one for Java and one for Android.
nuxeo-automation-clientdesign was based on Automation API before REST endpoints were available in the Nuxeo Platform
- Upload and download were missing
- Marshalling was difficult to use and debug
nuxeo-automation-clientwas then forked to build an Android version with some caching.
Since our REST APIs have evolved, we wanted to create a new one compliant with Android that uses the latest Java client libraries.
Today, we are very happy to announce the release of the Nuxeo Java Client 1.0 with these cool features:
- Supports the latest REST and resource centric API of the Nuxeo Platform
- Fluent programming with objects, such as documents, users, groups, workflows, etc.
- Upload in normal or chunk mode
- Automation REST API calls
- Android compatible (using OkHttp/Retrofit of Square)
- Simple marshalling with Jackson FasterXML
Test it out and give us your feedback!
Here’s the documentation that will show you how to get the Nuxeo Java Client 1.0 through Maven. It also has some exhaustive examples to help you begin your implementation quickly.
Here are some examples on how to use the client:
Creating a Client
Here’s how you can create a create a client:
For a given url:
String url = "http://localhost:8080/nuxeo";
And given credentials:
NuxeoClient nuxeoClient = new NuxeoClient(url, "Administrator", "Administrator");
To use the Automation API, org.nuxeo.client.api.NuxeoClient#automation() is the entry point for all calls:
// Fetch the root document
Document result = nuxeoClient.automation().param("value", "/").execute("Repository.GetDocument");
// Execute query
Operation operation = nuxeoClient.automation("Repository.Query").param("query", "SELECT * " + "FROM Document"); Documents result = operation.execute();
// Fetch the root document
Document root = nuxeoClient.repository().fetchDocumentRoot();
// Fetch document by path
Document folder = nuxeoClient.repository().fetchDocumentByPath("/folder_2");
// Create a document
Document folder = nuxeoClient.repository().fetchDocumentByPath("/folder_1"); Document document = new Document("file", "File");
document.set("dc:title", "new title");
document = nuxeoClient.repository().createDocumentByPath("/folder_1", document);
Android Nuxeo Share
In the same repository on Github, you will find an Android
Nuxeo Sharesample using
nuxeo-java-clientfor sharing binary files from your Android to a remote Nuxeo server.
The APK is available here for installing on your Android (tested on Nexus 5X with the latest Android version).
Here is a short demo to give you an idea of Nuxeo Share!