[dev] Pass parameters via json RPC
Thomas Jarosch
thomas.jarosch at intra2net.com
Thu Aug 1 15:27:10 UTC 2013
Hey there,
I try to use the json RPC API of Horde.
Here's the code derived from the (xmlrpc) RPC example code:
----------------------------------------------------
<?php
/**
* @package Rpc
*/
require_once '/usr/share/pear/www/horde/lib/Application.php';
Horde_Registry::appInit('horde', array('cli' => true));
// XML-RPC endpoint
$rpc_endpoint = 'http://localhost/horde/rpc.php';
// XML-RPC method to call
$rpc_method = 'notes.getChangesByModSeq';
// XML-RPC options, usually username and password
$rpc_options = array(
'request.username' => 'USERNAME',
'request.password' => 'MY_PASSWORD',
);
$params = array('start' => '0',
'end' => '100');
$http_client = new Horde_Http_Client($rpc_options);
$result = Horde_Rpc::request(
'jsonrpc',
$GLOBALS['rpc_endpoint'],
$GLOBALS['rpc_method'],
$GLOBALS['http_client'],
$params);
var_dump($result);
----------------------------------------------------
The API call works when I hardcode the "start" and "end"
parameters inside mnemo/lib/Api.php.
What's the correct way to encode the
"start" and "end" parameters for the RPC call?
Right now it does not recognize the parameters.
Cheers,
Thomas
More information about the dev
mailing list