According to the W3C, a web service is a software system designed to support interoperable machine-to-machine interaction over a network. In other words, a web service is any software that allows two or more programs (machine-to-machine) to exchange information and/or instructions (interoperable interaction) across the Internet or a local area network.
When it comes to web services and Drupal there are two distinct things you can do: configure Drupal to expose data and actions as a service that can be consumed via a third party, or use Drupal to consume content from, or interact with, a service provided by a third party.
Pro tip: The Drupal community often uses the term headless, headless Drupal, or Decoupled Drupal to describe the process of using Drupal as a web services API provider. So keep an eye out for tutorials and documentation that mention headless or decoupled Drupal.
- Expose data in a Drupal site as JSON via a REST API
- Allow users to authenticate against Drupal from different clients
- Write a module that interacts with an API provided by a third party
The web services landscape in Drupal 8, especially with regards to implementing an API, is constantly evolving. Much of this work is happening in contributed modules and may or may not make it into future versions of Drupal core. For this reason we recommend looking for up-to-date and more recent content where available.
December 9, 2015 - 8:02am
With the release of Drupal 8 comes a new way of making web requests, available via the Drupal::httpClient. This is simply a wrapper for the wonderful Guzzle HTTP Client. In this post, we'll take a look at how we can use the Drupal::httpClient class for making HTTP requests in a module.