Version 16 (modified by Fran Boon, 13 years ago) ( diff )


Web Services

gluon/ supports easy exposing of functions to XMLRPC or JSONRPC:

(originally in T3:


from import Service
service = Service(globals())


def organisation():
    "RESTlike CRUD controller"
    return shn_rest_controller(module, 'organisation')

Can test authentication/REST using wget/curl:

Token-based authentication:

Note that most web-services clients don't support cookies & hence are stateless (no sessions support):

We can access data from the database exported as JSON (for easy use within Javascript clients) by simply calling the RESTlike controller with the var ?format=json:

/sahana/module/resource?format=json           # Lists all records of this resource
/sahana/module/resource/id?format=json        # Display record with
/sahana/module/resource/create?format=json    # ToDo
/sahana/module/resource/update/id?format=json # ToDo

Another approach (using JSONRPC e.g. with Pyjamas):

Twitter feeds as JSON:


Note: See TracWiki for help on using the wiki.