Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
REST API FOR MULTI-TIER DEVELOPMENT<br />
What if you don't want to program XQuery, XSLT, or JavaScript on the server? For<br />
that, MarkLogic provides a standard REST web service interface. The REST API<br />
exposes the core functionality required by applications connecting to MarkLogic:<br />
document insertion, retrieval, and deletion; query execution with paging, snippeting,<br />
and highlighting; facet calculations; and server administration.<br />
You construct a REST API endpoint the same as one for HTTP or XDBC. You then<br />
communicate with it by making remote web calls from any client language (or program)<br />
you like. MarkLogic provides and supports libraries for Java and Node.js. The libraries<br />
are wrappers around the REST API, hiding the underlying network calls and data<br />
marshaling from the developer. Other languages can communicate directly to REST or<br />
use one of several community-developed open source libraries.<br />
An advantage to the REST API is that it lets you keep your favorite IDE, web<br />
framework, unit testing tools, and all the rest. If you want features beyond what the<br />
REST API provides, it includes an extensibility framework. For that, you (or someone)<br />
will need to write a bit of custom XQuery or JavaScript.<br />
For more information, see the REST Application Developer's Guide.<br />
JAVA CLIENT API<br />
The Java Client API provides out-of-the-box data management, query, aggregation, and<br />
alerting for MarkLogic. It encapsulates performance and scalability best practices into<br />
a comprehensive API that is familiar and natural to an enterprise Java developer. The<br />
API has hooks for tapping into Java's rich I/O ecosystem to work efficiently with native<br />
JSON and XML in MarkLogic, or with plain old Java objects (POJOs) in Java.<br />
For applications that require the extra performance benefits of running server-side<br />
code, the Java Client API provides an RMI-like extensibility mechanism and APIs<br />
to manage server-side libraries from Java. This hook allows developers to package<br />
JavaScript or XQuery code that runs in the database, close to the data.<br />
The Java API co-exists with Java XCC, described below, which provides a lower-level<br />
interface for running remote or ad hoc XQuery or JavaScript calls.<br />
Use of the Java Client API is demonstrated in the MarkLogic Samplestack project.<br />
Samplestack is a three-tier reference architecture that uses Java as a middle tier (the<br />
project also includes a middle tier based on the Node.js Client API).<br />
The Java Client API is being developed by MarkLogic in the open at GitHub. You can<br />
find more information in the Java Application Developer's Guide.<br />
61