Your first API

To have your first API you just need to create an Endpoint. It is done very easily with a scaffold:

mvn yawp:endpoint -Dmodel=person

Now we can change the Person class to add the name attribute:

@Endpoint(path = "/people")
public class Person {
    IdRef<Person> id;
    String name;

Just start the development server:

mvn yawp:devserver

After the development server starts, you can play with the Person endpoint APIs with cURL. To create a person, execute in a shell:

curl -H "Content-type: application/json" -X POST \
     -d "{'name': 'John'}" http://localhost:8080/api/people

To list the created person:

curl http://localhost:8080/api/people

To access it from your Web or NodeJS apps, you can use the YAWP! javascript client library.

Install it:

npm install yawp --save

And crate a person:

var yawp = require('yawp');

var promise = yawp('/people').create({name: 'janes'}).then(function(person) {
    console.log('created',; = 'janes joplin';
    return {