Parallel to the Services module, the Clients module provides the ability to implement pluggable clients to external web services, including external Drupal sites running the Services module, the main use case being ingesting content from other Drupal installs via the Services module with either the REST or XMLRPC server.
Clients module allows you to create connections to remote services with an admin UI. These handle fetching a result from a remote service. Different types of connection are provided for different types of services. There is a Drupal client connection type for different versions of Services (5.x-0.92, 6.x-2.x, 7.x-3.x), hence Clients can be used to connect to sites with different versions of Drupal.
Resources can be defined on top of connections, which provide an abstraction layer so that other parts of Drupal can work with remote data without needing to know anything about the connection. An example module for remote Views blocks is included.
Connections and resources can be exported to Features. The UI also provides a system for testing connections are correctly set up and functioning, which can be extended to provide site-specific tests.
- Entity API
- Autoload (Drupal 6 only)
The aim of Clients is to make it very simple to make calls to remote services. Clients takes care of all the necessary interactions with the remote site, such as connecting, logging in, working with tokens, and so on. This makes connecting to a remote service almost as simple as just calling a function.
For example, for XMLRPC connections:
// 'my_connection' is the machine name of the connection.
$result = clients_connection_call('my_connection', 'method.name', $param1, $param2, $param_etc);