Version 12 (modified by Fran Boon, 15 years ago) ( diff )

Can authenticate using wget/Curl (no need for browser)

Web Services

We want to be able to access data from the database exported as JSON for easy use within Javascript clients.

This can be done 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

The underlying output functions are very easy within Web2Py since 1.55:

def display_json():
    "Designed to be called via AJAX to be processed within JS client."
    return dict(item=list) now supports easy exposing of functions to XMLRPC or JSONRPC:

(originally in T3:


from import Service


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

Can authenticate using wget/Curl (no need for browser):

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

Twitter feeds as JSON:


Note: See TracWiki for help on using the wiki.