agrest principle scheme protocol and framework for flexible model-driven
REST data services


RESTful Data Services with Agrest (formerly known as LinkREST) - a JEEConf presentation

getting started

<!-- Add Maven Dependency -->

// Load in JAX RS Application

public class JaxRsApplication extends ResourceConfig {
    public JaxRsApplication() {
        ServerRuntime cayenneRuntime = ..
        AgRuntime agRuntime =;
// Write a JAX-RS Resourcy

public class MyEntityResource {
    private Configuration config;

    public DataResponse<MyEntity> getAll(@Context UriInfo uriInfo) {
        return, config).uri(uriInfo).get();
# Start Sending Requests

curl -i -X GET \



Client Shapes the Response

Provides REST API that allows client to filter, sort, paginate the response. Client can request specific properties of "root" entity and recursively include data of related entities.


Supports reading / modifying data objects, collections and relationships.

Vanilla HTTP / JSON

Based on common REST HTTP interactions. Serves data as JSON.


Java DSL for Building REST APIs for Data Stores

Features easy-to-use fluent Java API to build customized processors for entity web methods. API works on top of JAX-RS standard. Reuses / extends entity model of a pluggable backend provider.

Supports Relational Databases

Supports relational databases via Cayenne ORM backend provider out of the box.

Pluggable Backend Providers for Other Data Stores

Supports alternative user-defined backends. E.g. for NoSQL stores, analytical queries, LDAP / Active Directory, etc.

Fine Grained Security

Straightforward integration with any Java authorization framework to provide attribute-level and object-level access control.