Differences between revisions 6 and 7
Revision 6 as of 2012-07-11 02:57:00
Size: 1691
Editor: IanRees
Comment:
Revision 7 as of 2013-04-18 06:18:18
Size: 1485
Editor: IanRees
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
All public API methods are available via both JSON-RPC and XML-RPC, which are language-neutral Remote Procedure Call protocols. Of these, JSON-RPC is recommended because it supports keyword arguments and has better representation of EMEN2 objects. We have published a simple JSON-RPC module for Python and JavaScript (described below) that can be used with EMEN2. XML-RPC is also supported, and many programming environments include an xmlrpc library by default (as is the case with Python.) All public API methods are available via JSON-RPC, which are language-neutral Remote Procedure Call protocols. We have published a simple JSON-RPC module for Python and JavaScript (described below) that can be used with EMEN2. In the future, we plan to provide similar access via a simpler REST API.
Line 15: Line 15:
Line 16: Line 17:
Line 17: Line 19:
Line 19: Line 22:
Line 22: Line 26:

= XML-RPC =

...

Accessing the EMEN2 Public API using JSON-RPC and XML-RPC

All public API methods are available via JSON-RPC, which are language-neutral Remote Procedure Call protocols. We have published a simple JSON-RPC module for Python and JavaScript (described below) that can be used with EMEN2. In the future, we plan to provide similar access via a simpler REST API.

JSON-RPC

We have published a reference implementation of JSON-RPC for Python and JavaScript. The Python module can be installed using the link above, or via "easy_install jsonrpc".

Example:

>>> import jsonrpc.proxy

>>> import getpass

>>> db = jsonrpc.proxy.JSONRPCProxy("http://ncmidb.bcm.edu")

>>> db.login("example@example.com", getpass.getpass())
Password: 

>>> db.record.get(0)
{u'modifyuser': u'root', u'name': 0, u'creator': u'root', u'keytype': u'record', u'creationtime': u'2007-07-23T15:30:22+00:00', u'uri': None, u'comments': [], u'rectype': u'folder', u'history': [[u'root', u'2010-04-27T19:28:05+00:00', u'recname', u'EMEN2'], [u'root', u'2010-04-27T19:28:05+00:00', u'name_folder', None]], u'parents': [], u'groups': [u'authenticated'], u'modifytime': u'2010-04-27T19:28:05+00:00', u'name_folder': u'EMEN2', u'children': [268323, 449989, 268295, 136, 433788, 268330, 448491, 492525, 265550, 268336, 358307, 265561, 265514, 270940, 260317, 266174], u'permissions': [[], [], [], []]}

EMEN2/rpc (last edited 2013-04-18 06:19:00 by IanRees)