simpleapi is an easy to use, consistent, transparent and portable way of providing an API. It supports several transport formats (e. g. json, jsonp, xml, yaml) and provides server (django, flask) and client libraries (PHP, Python) to interact seamlessly. You can also use nearly every Ajax framework (e. g. jQuery, ExtJS, etc.) to access the API.

To install, simply run:

# pip install --upgrade simpleapi

The source is available on GitHub. You can als follow simpleapi on twitter @simpleapi to stay up-to-date.


This documentation is uncomplete and will be finished over the next few weeks. Please be patient.

Easy example (in your django app)

from simpleapi import Namespace

class Calculator(Namespace):
    def add(self, a, b):
        return a + b
    add.published = True

in django:

from simpleapi import Route
from handlers import Calculator

urlpatterns = patterns('',
    (r'^api/calculator/$', Route(Calculator))

in Flask:

from simpleapi import Route
from handlers import Calculator

from flask import Flask

app = Flask(__name__)
app.route('/api/')(Route(Calculator, framework='flask'))

if __name__ == '__main__':

Python Client (using simpleapi’s client library)

from simpleapi import Client

calculator = Client(ns='http://localhost:8888/api/calculator/')
print "5 + 3 =", calculator.add(a=5, b=3)

PHP Client (using simpleapi’s PHP client)

    $calculator = new Client(ns='http://localhost:8888/api/calculator/');
    print("5 + 3 ".$calculator->add(array('a'=>5, 'b'=>3)));

JavaScript Client (using jQuery)

    {_call: 'add', a: 5, b: 3},
    function (result) {
        alert('5 + 3 = ' + result);