Drupal  8.3.5
APl Documentation
REST and Application Integration

Data Structures

class  Json
class  RestResource
class  ResourceBase
interface  ResourceInterface

Detailed Description

Integrating third-party applications using REST and related operations.

Overview of web services

Web services make it possible for applications and web sites to read and update information from other web sites. There are several standard techniques for providing web services, including:

Overview of REST

The REST technique uses basic HTTP requests to obtain and update data, where each web service defines a specific API (HTTP GET and/or POST parameters and returned response) for its HTTP requests. REST requests are separated into several types, known as methods, including:

REST requests can be authenticated. The Drupal Core Basic Auth module provides authentication using the HTTP Basic protocol; the contributed module OAuth (https://www.drupal.org/project/oauth) implements the OAuth authentication protocol. You can also use cookie-based authentication, which would require users to be logged into the Drupal site while using the application on the third-party site that is using the REST service.

Enabling REST for entities and the log

Here are the steps to take to use the REST operations provided by Drupal Core:

For more detailed information on setting up REST, see https://www.drupal.org/documentation/modules/rest.

Defining new REST plugins

The REST framework in the REST module has support built in for entities, but it is also an extensible plugin-based system. REST plugins implement interface , and generally extend base class . They are annotated with annotation, and must be in plugin namespace subdirectory Plugin. For more information on how to create plugins, see the Plugin API topic.

If you create a new REST plugin, you will also need to enable it by providing default configuration or configuration import, as outlined in Enabling REST for entities and the log above.

Integrating data from other sites into Drupal

If you want to integrate data from other web sites into Drupal, here are some notes: