Tranquil APIs

v0.1

Nick Moore <nick@mnemote.com>

Tranquil APIs

Tranquil: Contexts

A context describes a group of resources.

Tranquil: Actions

For example, the “all users” context could be transformed into the “users over 35” context using a “filter” action.

Tranquil: Composing Actions

Action Lists

Builds a pipeline of actions

[ [ "filter", { "is_author": true } ], "count" ]

Action Groups

Labels actions and runs them in parallel

{
    "count": "count",
    "page": [ [ "page", 0, 5 ] ]
}

Tranquil: Composing Actions

{
    "authors": [
        "users",
        [ "filter": { "is_author": true } ],
        {
            "count": "count",
            "top10": [
                [ "sort", "-score" ],
                [ "page", 0, 10 ]
            ]
        }
    ]
}

Tranquil: Composing Actions

{
    "authors": {
        "count": 23,
        "top10": [
            { "name": "Fred Nerk", ... },
            { "name": "Joe Blow", ... },
            ...
        ]
    }
}

Tranquil: HTTP Transport

POST /api
Content-Type: application/json
Accept: application/json

{ "user_count": [ "users", "count" ] }
200 OK
Content-Type: application/json

{ "user_count": 107 }

Transport Agnostic

More!