Overview of Services

Last updated on
30 April 2025

Overview

Services is comprised of 2 components:

  • services: Modules which contain functions intended to be invoked from remote.
  • servers: Modules which provide a connection protocol, such as XMLRPC.

How to Authenticate with Sessions enabled

In order to authenticate to Services, you must first request an anonymous session id. You do this with the system.connect method.

Once you have an anonymous session id, then submit another xmlrpc request with the user.login method using three variables: anonymous session id, username, password.

If authentication is successful then the xmlrpc response will include a valid session id. The xmlrpc response will also include a whole bunch of information about the user and profile information.

If authentication fails, it may be for several reasons. The xmlrpc response should give you a clue to the reason.

Some services such as node.load now check a user's permissions before providing the data. If the user's permission is insufficient, an 'access denied' error is returned.

In order to authenticate, here is the general flow of services requests:

session = system.connect();
user = user.login(session, 'MyName');
node.save(session, mynode);

Hooks

services

  • hook_service(): This is where you map your services and methods to functions. You can provide help text and argument details for each method, to be used in the service browser.

servers

  • hook_server_info(): Specify information about your server.
  • hook_server(): Converts an incoming request into a Drupal function call and then converts the result back into the appropriate return format.

Help improve this page

Page status: Not set

You can: