Skip directly to content

Ben Melançon: "Powering your API with Drupal 8"

Thursday, March 20, 2014 - 6:30pm

Drupal Nights

Davenport Conference Room
25 1st Street
Cambridge, MA 02141

Event Type: 

Drupal 8 comes with "Built-in Web Services", the official 8 promotion page is proud to say, but what does that mean for you as a developer (or someone who has some influence on Drupal developers)? The new feature teaser isn't too specific:

"Build mobile apps with Drupal as the data source, or even post back to Drupal from the client. Drupal 8 implements state-of-the-art Hypertext Application Language (HAL) as well. Do you want to expose content as JSON or XML, authenticate a client with HTTP authentication, or expose views-generated lists as services? You can do all that and more. The possibilities are endless."

We will look at how Drupal's web services (thanks to the Web Services and Context Core Initiative, or WSCCI) makes it possible to use Drupal 8 to very easily create APIs that other sites, including other Drupal sites of different versions, can use to get information or provide information back.

And to that end we'll talk about REST, RESTful APIs (which are not as comfortable as they sound), HATEOAS (which is not as hateful as it sounds), and the HAL specification (which is not quite as scary as it sounds, Dave).

Then we'll cover how to do this in Drupal 8 and demonstrate a practical working example for Drupal RESTful APIs which will put the web to perhaps the most reprehensible use a web developer can contribute to: Domain hoarding.

We will probably not cover the really hard part, which is finding an existing definition for the resources. In REST, this means media types. See one e-commerce company's journey toward Hypermedia for how far down the rabbit hole this goes, and Toward HyperDrupal for the perspective of a wombat (Ryan Szrama of Drupal Commerce fame).

Ben Melançon

As part of Agaric, I've tried to contribute back to Drupal some small measure in return for all that it has given us. This includes a few core patches and more patch reviews, organizer and contributing author of The Definitive Guide to Drupal 7.