JSON-RPC Client
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Downloads
Component created
Component changed
Component body
A simple API class that implements a JSON-RPC client. It can be used to call a JSON-RPC service on another Drupal server or many other JSON-RPC services.
As an API module, this doesn't do anything on it's own and will only be useful if you are writing a module or doing some other Drupal coding.
What works
Works with JSON-RPC version 2.0, but probably does not implement the full specification. Not tested with 1.1. Doesn't support batch calls in JSON-RPC 2.0.
Handles optional parameters, API key authentication and session IDs necessary to authenticate with a Drupal API key protected JSON-RPC service.
Requirements
Requires PHP 5.2 or later, due to use of json_decode() function.
Examples
Sample use (basic):
<?php
module_load_include('module', 'jsonrpc_client');
$client = new JsonRpcClient(
'http://example.com/services/json-rpc',
'2.0'
);
$result = $client->call('system.connect'); //return associative array
?>
Sample use (API key plus parameter):
<?php
module_load_include('module', 'jsonrpc_client');
$client = new JsonRpcClient(
'http://example.com/services/json-rpc',
'2.0',
'abb14a47862a041f76a442ac0f38f332', 'example.com'
);
$result = $client->call('my_service.baz', array('foo' => 'bar') );
?>
Development of this module supported by Myplanet Digital
