Drupal Services Module

Jun 25, 2012
Julio Canadas

We’ve been working on extending the Drupal Service module in order to extract some information off from a Drupal site to be used for various purposes For reference the base module can be found here: http://drupal.org/project/services It provides basic functionality that can be extended upon. Due to various requirements for different projects, we’ve built on it to create customized calls that expose data according to our needs.

The module allows calls in multiple interfaces, such as REST, XMLRPC, JSON, JSON-RPC, SOAP, AMF among others. We’ve chosen JSON

Here is an example call which returns Garland Template data:

 

 

Figure 1: Garland Template JSON

 

 

 

You can protect the exposed data in various ways. Authentication is handled through Drupal logins. Different users can have access to different data.

After login, authentication to the various services are handled by a session cookie

 

Figure 2: Session cookie for authenticated user

Here is an example of node data for an authenticated user:

 

Figure 3: Full node data

 

And for a non authenticated user that is allowed to see limited data. In this case you can see the available data is severely limited compared to the previous example

 

Figure 4: Guest node data

 

You can also prevent any response to guests

 

Figure 5: 401 guest call

 

The data extracted from Drupal can then be used for your own purposes such as data migration, analytics, etc.