Skip to content
RESTHeart's customization examples
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

RESTHeart Customization Examples

RESTHeart - The leading Web API for MongoDB.

  Done with love by the SoftInstigate Team

The following customization examples are included:

  • ExampleIdentityManager an Identity Manager, see documentation
  • ExampleAccessManager an Access Manager, see documentation
  • ExampleAggregateHandler a simple Application Logic Handler that executes an aggregation query, see documentation

How to run the examples

$ git clone
$ cd restheart-customization-examples
$ mvn package
$ cp <RESTHEART_DIR>/restheart.jar .
$ java -cp restheart.jar:target/restheart-customization-examples-1.0-SNAPSHOT.jar org.restheart.Bootstrapper etc/restheart.yml 

Create test data

You need to install httpie

$ http -a admin:nimda PUT desc="a db for testing"
$ http -a admin:nimda PUT desc="a collection to hold gread bands data"
$ http -a admin:nimda PUT " Floyd" albums:='["The Piper at the Gates of Dawn","A Saucerful of Secrets","More" \
,"Ummagumma","Atom Heart Mother","Meddle","Obscured by Clouds","The Dark Side of the Moon","Wish You Were Here","Animals" \
,"The Wall","The Final Cut","A Momentary Lapse of Reason","The Division Bell","The Endless River"]'

$ http -a ciao:oaic
HTTP/1.1 200 OK

    "Pink Floyd": 15, 
    "_embedded": {}, 
    "_links": {
        "self": {
            "href": "/_logic/aggregate"


This IDM verifies the password to be the flipped id string, i.e. id="username" => pwd="emanresu"


This Access Manager gives read access to the /test/band collection and /_logic/aggregate to any authenticated user. It also gives write access to user "admin"


This custom Hanlder is boud to /_logic/aggregate URI. It execute a simply aggregation query that returs the count of ablums published by bands.

You can’t perform that action at this time.