Services 7.x-3.3, REST Server using 2-Legged OAuth in PHP, OAuth 7.x-3.x-dev

The Drupal REST services is an user-created module for Drupal 7 and 6.

The module converts resources on Drupal sites - content types - into REST, XMLRPC, JSON, JSON-RPC, SOAP, AMF and other types for easy parsing by external applications.

It can also enable Drupal sites to accept CRUD operations to modify resources.

The requests between Drupal and external applications can have authentications via OAuth.

Installation

  1. Install Services module 7.x-3.3 - http://drupal.org/project/services
  2. Install Services Views module 7.x-1.0-beta2 - http://drupal.org/project/services_views
  3. Enable both modules and the REST server module.
  4. Install OAuth 7.x-3.0+18-dev - http://drupal.org/project/oauth (You must use this version because the recommended version - 7.x-3.0 - is bugged)

Note:
The Libraries module must be at least version 7.x-2.0 for REST server.

Config

This is a two-stage process.
First, make a Service Endpoint that hosts REST resources; it is seen as the first part of the URL to your resource.
Next, make a REST resource, which is a View customized by the Services View module; in it, you specify which Content Types are included.
Authentication is configured afterwards.

Config Endpoint / View without OAuth

Creating a REST Server with 2-Legged OAuth Authentication (Example with Java Servlet)

Apparently the way to get content from a Drupal site to another site/application is to use services. And also it would seem that using session based authentication is sooo last Drupal 6. So the recommended, yet not at all properly documented (like, anywhere), method is for an application to use 2-Legged OAuth authentication to authenticate and exchange data.

I spent some time getting angry at Drupal and OAuth and module makers and everyone who wouldn't provide a clear guide how to do this, and so now I have what I believe is a correctly working implementation (if it's not, please tell me where I'm wrong) I pass this information on to you dear reader.

Subscribe with RSS Subscribe to RSS - 2-legged