User Tools

Site Tools


code:xmlrpc

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
code:xmlrpc [2008/12/29 22:29]
pkubanek added link to r2x.h
code:xmlrpc [2009/02/20 00:00] (current)
Line 10: Line 10:
 As first parameter to every XML-RPC call, you must pass an identification token. It is always a structure, and holds either credentials,​ or session ID. As first parameter to every XML-RPC call, you must pass an identification token. It is always a structure, and holds either credentials,​ or session ID.
  
-Credentials are passed in structure under //login// and //​password//​ fields. So for example if +Credentials are passed in structure under //login// and //​password//​ fields. So for example if you are calling rts2.mainstatus,​ the procedure in Python will be: 
 + 
 +<code python>​ 
 +import xmlrpclib 
 +xmlRpcServer = xmlrpclib.ServerProxy("​http://​localhost",​ use_datetime = True) 
 +res = xmlRpcServer.rts2.mainstatus ({'​login':​ '​myname',​ '​password':​ '​test'​}) 
 +print res 
 +</​code>​ 
 + 
 +Session ID can be obtained by rts2.login call. Then it should be passed as session_id parameter to all subsequent calls. Following example demonstrates how to use session_id:​ 
 + 
 +<code python>​ 
 +res = xmlRpcServer.rts2.login ({'​login':​ '​myname',​ '​password':​ '​test'​}) 
 +sess_id = res['​session_id'​] 
 +res = xmlRpcServer.rts2.mainstatus ({'​session_id'​ : sess_id}) 
 +print res 
 +</​code>​ 
 + 
 +Session id's expire after inactivity. The time of inactivity is defined in response field '​expires'​. Before session ID expires, you can renew it by making call to rts2.login, with session_id as only parameter.
  
 ===== Commands ===== ===== Commands =====
  
 There is description of commands. Please see also [[http://​rts-2.svn.sf.net/​viewvc/​rts-2/​trunk/​rts-2/​src/​xmlrpc/​r2x.h|xmlrpc/​r2x.h]] file for probably more up-to date description. There is description of commands. Please see also [[http://​rts-2.svn.sf.net/​viewvc/​rts-2/​trunk/​rts-2/​src/​xmlrpc/​r2x.h|xmlrpc/​r2x.h]] file for probably more up-to date description.
 +
 +==== rts2.login ====
 +
 +This call accepts two parameters. The first is login name, the second is password. Returns session id, which can be used in subsequent calls to authorize them.
  
 ==== rts2.devices.list ==== ==== rts2.devices.list ====
code/xmlrpc.1230586194.txt.gz · Last modified: 2008/12/29 00:00 (external edit)