[module] Services [and REST Server]

Compatibility:

0
Project page quote (external)
Project page quoted on: 
2014-03-16

A standardized solution of integrating external applications with Drupal. Service callbacks may be used with multiple interfaces like REST, XMLRPC, JSON, JSON-RPC, SOAP, AMF, etc. This allows a Drupal site to provide web services via multiple interfaces while using the same callback code.

...

Since our documentation is somewhat lacking on drupal.org, you can watch this for a 1 hour overview of what services is and what it does. http://denver2012.drupal.org/program/sessions/services-inside-and-out If for some reason that site is down, the video can be found here http://www.youtube.com/watch?v=6-2kw7iXf1U

Visit the Services Handbook for help and information. Subscribe to the Services Group for news, updates and discussions.

From Services Installation and Setup:

Installation is typical of any Drupal module. Services 3.x does have several dependencies you will need.

Drupal 7 dependencies:

- CTools

- Libraries (if using Rest Server)

Drupal 6 dependencies:

- CTools

- Inputstream (if using REST Server)

- Autoload (if using REST Server).

After getting these dependencies in place you can install as you normally would.

The main Services administration area is at admin/structure/services. Click on the "Add" link on that page to create a new service definition. You can also use the "Import" link to import a service definition that has been exported from another Drupal website running services. (The Services modules uses a CTools export_ui plugin to support adding, importing and exporting service definitions.)

services_ui2.png.png

Services are defined as 'endpoints'. An endpoint is a unique URL stem that acts as a base for all calls. Each endpoint is defined by a combination of URL, server, and authentication. So for instance you could define two REST services, one authenticated and one available for anonymous users, with unique URLS like

http://example.com/api/anonymous/
http://example.com/api/authenticated

In addition to defining a unique URL, the service definition specifies what type of server is used to return data requests (e.g., REST, XMLRPC, etc.):

services_add_endpoint.png

Depends on modules [Drupal7]
Required by modules [Drupal7[
This demonstration has been temporarily disabled. Readers are encouraged to install Services and follow the tutorial Testing Services with the node resource.

The example at Testing Services with the node resource has been implemented on this site with read-only functionality, so public WWW users can't do any harm. To perform a REST node resource GET on the node with id 1 with XML return format use:

The usual page access restrictions apply, if you attempt access a permitted node you should get a
HTTP/1.1 200 OK, if you try to access a restricted or unpublished node your will get HTTP/1.1 403 Forbidden.


For Mac OS X I recommend the Wiztools.org REST Client GUI app for testing. Both Firefox and Chrome also have REST client plugins.

Visit also